Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to add overrides when using an inherited PersistenceModel #86

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

Unable to add overrides when using an inherited PersistenceModel #86

Philo opened this issue Aug 23, 2011 · 1 comment
Labels

Comments

@Philo
Copy link

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
Copy link
Author

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
Labels
Projects
None yet
Development

No branches or pull requests

1 participant