Действительно ли ti возможен настроить поставщика кэша L2 в коде через FHN?
Добавление строки к следующей конфигурации - то, что я после:
return Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2005.ConnectionString(c => c.FromConnectionStringWithKey("Temp")).ShowSql())
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<IMap>())
.ExposeConfiguration(c => { })
.BuildSessionFactory();
Аплодисменты
AWC
Это возможно из 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();
Ура
AWC
Обратите внимание, что для Fluent NHibernate> = 3.4.0.0 конфигурация немного отличается. Используйте пакет nuget для SysCache из 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();