Fluent 1.2 从 NH 3.0 升级到 3.1 时出现警告 -- ProxyFactoryFactory 已过时,移至

发布于 2024-11-26 12:29:23 字数 1271 浏览 1 评论 0原文

我对 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

饮湿 2024-12-03 12:29:23

在最后几个 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();

In the last couple of FluentNHibernate builds, the ProxyFactoryFactory method was moved out of Database to directly off of Configure. Try this:

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();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文