fluent-nhibernate
fluent-nhibernate copied to clipboard
Unable to add overrides when using an inherited PersistenceModel
.UseOverridesFromAssemblyOf<>() and .UseOverridesFromAssembly() when used within an inherited PersistenceModel cause an "Object reference not set to an instance of an object" exception at line 366 of FluentNhibernate/automapping/AutoPersistenceModel.cs.
The attempt to retrieve a reference to the "OverrideHelper" method via this.GetType() returns null:
var overrideInstance = Activator.CreateInstance(overrideType);
GetType()
.GetMethod("OverrideHelper", BindingFlags.NonPublic | BindingFlags.Instance)
.MakeGenericMethod(entityType)
.Invoke(this, new [] {x, overrideInstance});
private void OverrideHelper<T>(AutoMapping<T> x, IAutoMappingOverride<T> mappingOverride)
{
mappingOverride.Override(x);
}
Possible fix would be to alter the OverrideHelper access modifier from private to protected. Trying this resolved my own problem