Unable to add overrides when using an inherited PersistenceModel #86

Open
Philo opened this Issue Aug 23, 2011 · 1 comment

Comments

Projects
None yet
1 participant

Philo commented Aug 23, 2011

.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);
    }

Philo commented Aug 23, 2011

Possible fix would be to alter the OverrideHelper access modifier from private to protected. Trying this resolved my own problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment