Right now, I'm switching my project over from the classic fluent nhibernate style of manually defining a ClassMap
for each domain entity, to having the auto-mapper auto-generate the mappings for me. But I'd like to keep using the classes I've already mapped in the classic style, until I can tweak the automappings to match the old classic mappings.
The only problem is that fluent nhibernate crashes when the auto mapper hits a class that's already been mapped in the classic fluent nhibernate style.
Here's my AutoPersistenceModel
setup code:
_autoPersistenceModel = AutoMap.AssemblyOf<DomainEntity>();
_autoPersistenceModel.AddMappingsFromAssembly(typeof (PlayerPersistenceMap).Assembly);
_autoPersistenceModel.Alterations(x =>
x.Add<AutoMappingAlteration>())
.Setup(s =>
{
s.FindIdentity = type => type.Name == "ID";
s.IsBaseType = type => (type == typeof(DomainEntity));
})
.Conventions
.AddFromAssemblyOf<IdentityColumnConvention>()
.UseOverridesFromAssemblyOf<PlayerMappingOverride>();
Can anyone help me out here?
More Info:
I also tried the technique mentioned on the fluent-nhibernate wiki here. Alas I'm still getting the error: Duplicate class/entity mapping
.