fluent-nhibernate
fluent-nhibernate copied to clipboard
Problem with conventions when combining AutoMap and Fluent mappings
Ive tried to combine auto-mapping with fluent mapping and hbm.xml
Ive added the same conventions for the autoMAp as for the fluent. Everyting was ok. If I removed the conventions from the AutoMap part, the conventions were not applied for the Fluent either.
_configuration = Fluently.Configure()
.Database(persistenceConfigurer)
.Mappings(m =>
{
m.AutoMappings.Add(
AutoMap.AssemblyOf<Entita>(new AutoMappingConfiguration())
.Conventions.AddFromAssemblyOf<AutoMappingConfiguration>()
// If you ommit conventions here, .FluentMappings.Conventions won't work either!
);
m.FluentMappings.Conventions.AddFromAssemblyOf<IMappingNamespaceMarker>(); m.FluentMappings.AddFromAssemblyOf<IMappingNamespaceMarker>();
m.HbmMappings.AddFromAssemblyOf<IMappingNamespaceMarker>();
})