이 예에서 아래의 '캐시'를 참조 FNH에서 가능하다 특성 :
return Fluently.Configure(fileConfiguration)
.Database(MsSqlConfiguration
.MsSql2005
.ConnectionString(c => c.FromConnectionStringWithKey("Temp"))
.ShowSql()
.Cache(c => c.ProviderClass(typeof(NHibernate.Cache.HashtableCacheProvider).AssemblyQualifiedName)
.UseQueryCache()))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<IMap>())
.ExposeConfiguration(c => {
c.EventListeners.PostLoadEventListeners = new IPostLoadEventListener[] {new TestPostLoadListener()};
})
.BuildSessionFactory();
건배
유창함 NHibernate에> = 3.4.0.0을위한
AWC
참고는 구성이 약간 다르다 나타난다. http://nuget.org/packages/NHibernate.Caches.SysCache
return Fluently.Configure(fileConfiguration)
.Database(MsSqlConfiguration
.MsSql2005
.ConnectionString(c => c.FromConnectionStringWithKey("Temp"))
.ShowSql())
.Cache(c => c.ProviderClass<SysCacheProvider>().UseQueryCache())
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<IMap>())
.ExposeConfiguration(c => {
c.EventListeners.PostLoadEventListeners = new IPostLoadEventListener[] {new TestPostLoadListener()};
})
.BuildSessionFactory();
ProviderClass 방법에서 SysCache에 대한 nuget 패키지를 사용하는 매개 변수를 입력하고 사용이 c.ProviderClass'로 다시 작성할 수 있습니다 받아()'. :) –
아마도 이미 알고있을 것입니다. 프로덕션 코드로 HashTable CacheProvider를 사용하지 마십시오. – Hace
왜 안 되니? 다른 옵션은 무엇입니까? – Seva