NHibernate ignoring proxyfactory property
I upgraded from NH 2.1 / Fluent 1.1 to NH 3.1 / Fluent 1.2. I was using LinFu as proxy, however after the upgrad开发者_C百科e no matter what I configure NH tries to load Castle. Im setting Fluent using
Configuration _Configuration;
FluentConfiguration _FluentConfig;
_Configuration = new Configuration();
_Configuration.Configure();
_FluentConfig = Fluently.Configure(_Configuration)
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<FluentNHSession>()))
Also nhibernate.cfg is configured to use linfu:
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
When running the application an exception is raised saying it cant find castle dll's. Using the same nhibernate.cfg but dropping castle ddl's in the bin directory works fine, seems like NH ignores the configuration.
I had the same problem. I solved it by including this line in my fluent configuration.
sessionFactory = Fluently.Configure(normalConfig)
.Mappings(m =>
m.FluentMappings
.AddFromAssemblyOf<OrderHeaderMap>()
.Conventions.AddFromAssemblyOf<PascalCaseColumnNameConvention>())
.ProxyFactoryFactory("NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu")
.BuildSessionFactory();
If this answer or any other answers here help you please mark it as the answer by clicking the check mark.
精彩评论