开发者

Warning when upgrading Fluent 1.2 from NH 3.0 to 3.1 -- ProxyFactoryFactory is obsolete, moved to

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().ProxyFactory开发者_如何转开发Factory(...))'

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.


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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜