Mixing a database configuration from a file using Fluent NHibernate

I came across the following problem: I wanted to configure the database from the configuration file, but the display smoothly (love it!) The configuration code looks like this:

var cfg = new Configuration();
cfg.Configure();
var fluentCfg = Fluently.Configure(cfg)
                        .Mappings(
                            m => m
                               .FluentMapping
                               .AddFromAssembly(Assembly.GetExecutingAssembly));

However, the configuration file has the property:

<property name="proxyfactory.factory_class">
  NHibernate.ByteCode.LinFu.ProxyFactoryFactory, 
  NHibernate.ByteCode.LinFu
</property>

and after cfg.Configure (); everything looks fine, configuration points for the LinFu bytecode provider, but after the third line, I see that the configuration has changed to using Castle. I looked in the Fluent code, and I could be wrong, but it looks like they are overriding this property in PersistenceConfiguration.cs (line 50) in the PersistenceConfiguration constructor:

values[ProxyFactoryFactoryClassKey] =  DefaultProxyFactoryFactoryClassName;

Is Fluent Castle required? Or maybe I'm doing something wrong or maybe it's just a mistake?

Thank.

+3
2

, , , . , , .

var cfg = Fluently.Configure()
                .Database(MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("ConnectionStringName")).ShowSql())
                .Mappings(m =>
                {
                    m.FluentMappings.AddFromAssemblyOf<MapMarker>();
                    m.FluentMappings.Conventions.AddFromAssemblyOf<ConventionMarker>();
                })
                .ExposeConfiguration(x => x.SetProperty("proxyfactory.factory_class", "NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"));
0

a ProxyFactoryFactory Configure.

Fluently.Configure()
  .ProxyFactoryFactory(name);

1.2, , Database (. RexM).

0

All Articles