gpt4 book ai didi

fluent-nhibernate - Fluent 1.2 从 NH 3.0 升级到 3.1 时出现警告 -- ProxyFactoryFactory is obsolete, moved to

转载 作者:行者123 更新时间:2023-12-03 23:40:16 24 4
gpt4 key购买 nike

我是 NHibernate 和 Fluent NHibernate 的新手,我已经使用 Fluent 1.2 for NH 3.0 大约 6 个月了。我刚刚为 NH 3.1 升级到 Fluent 1.2。现在我收到警告(在 Visual Studio 中),我试图修复它但没有成功。我需要一些帮助...

在我的 Global.asax 文件中,我流畅地配置了 NHibernate:

var nhConfig = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008.ConnectionString(connstr => connstr.FromConnectionStringWithKey("MyDatabase"))
.ProxyFactoryFactory<ProxyFactoryFactory>().AdoNetBatchSize(100))
.Mappings(mappings => mappings.FluentMappings.AddFromAssemblyOf<MyClass>())
.ExposeConfiguration(c => c.Properties.Add("current_session_context_class", "web"))
.BuildConfiguration();

我收到一条警告:

.ProxyFactoryFactory<ProxyFactoryFactory>().AdoNetBatchSize(100))

这是警告:

FluentNHibernate.Cfg.Db.PersistenceConfiguration<FluentNHibernate.Cfg.Db.MsSqlConfiguration,
FluentNHibernate.Cfg.Db.MsSqlConnectionStringBuilder>.ProxyFactoryFactory<TProxyFactoryFactor y>()'
is obsolete: 'Moved to FluentConfiguration Fluently.Configure().ProxyFactoryFactory(...))'

我想我需要使用 FluentlyConfigure().ProxyFactoryFactory(),但该方法的帮助/智能感知表明它仅适用于 NH 2.1。

我应该在我的配置中做什么来消除这个警告并且不使用过时/弃用的方法?

谢谢。

最佳答案

在最近的几个 FluentNHibernate 构建中,ProxyFactoryFactory 方法从 Database 中移出,直接从 Configure 中移出。试试这个:

var nhConfig = Fluently.Configure()
.ProxyFactoryFactory<ProxyFactoryFactory>()
.Database(MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("MyDatabase").AdoNetBatchSize(100))
.Mappings(mappings => mappings.FluentMappings.AddFromAssemblyOf<MyClass>())
.ExposeConfiguration(c => c.Properties.Add("current_session_context_class", "web"))
.BuildConfiguration();

关于fluent-nhibernate - Fluent 1.2 从 NH 3.0 升级到 3.1 时出现警告 -- ProxyFactoryFactory is obsolete, moved to,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6838344/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com