Fluent 1.2 从 NH 3.0 升级到 3.1 时出现警告 -- ProxyFactoryFactory 已过时,移至
我对 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。
我应该在配置中做什么来消除此警告而不使用过时/已弃用的方法?
谢谢。
I'm fairly new to NHibernate and Fluent NHibernate and I've been using Fluent 1.2 for NH 3.0 for about 6 months. I just upgraded to Fluent 1.2 for NH 3.1. Now I'm getting a warning (in Visual Studio), and I've tried to fix it but no luck. I could use some help...
In my Global.asax file, I Fluently-configure 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();
I'm getting a warning on the line:
.ProxyFactoryFactory<ProxyFactoryFactory>().AdoNetBatchSize(100))
Here's the warning:
FluentNHibernate.Cfg.Db.PersistenceConfiguration<FluentNHibernate.Cfg.Db.MsSqlConfiguration,
FluentNHibernate.Cfg.Db.MsSqlConnectionStringBuilder>.ProxyFactoryFactory<TProxyFactoryFactor y>()'
is obsolete: 'Moved to FluentConfiguration Fluently.Configure().ProxyFactoryFactory(...))'
I think I need to use the FluentlyConfigure().ProxyFactoryFactory(), but the help/intellisense for that method says it's only for NH 2.1.
What should I be doing in my configuration to eliminate this warning and not use obsolete/deprecated methods?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在最后几个 FluentNHibernate 版本中,
ProxyFactoryFactory
方法已从Database
移出,直接从Configure
中移出。试试这个:In the last couple of FluentNHibernate builds, the
ProxyFactoryFactory
method was moved out ofDatabase
to directly off ofConfigure
. Try this: