Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Unable to add overrides when using an inherited PersistenceModel #86

Open
Philo opened this Issue · 1 comment

1 participant

@Philo

.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

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
Something went wrong with that request. Please try again.