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

Use a callback to configure conventions for a context #693

Open
johelvisguzman opened this issue Apr 12, 2022 · 0 comments
Open

Use a callback to configure conventions for a context #693

johelvisguzman opened this issue Apr 12, 2022 · 0 comments
Labels
enhancement Updates existing code to be simpler, more powerful or adds somehow to existing functionality

Comments

@johelvisguzman
Copy link
Owner

johelvisguzman commented Apr 12, 2022

Instead of overriding the convention property we should probably use a callback instead. That way there is more flexibility and freedom.

The following will need to be revised:

.../src/DotNetToolkit.Repository/RepositoryBase.cs

private void ConfigureContext(IRepositoryContext context)
{
    Guard.EnsureNotNull(context.Conventions, "No conventions have been configured for this context.");

    if (_options.Conventions != null)
        RepositoryConventions.Combine(_options.Conventions, context.Conventions);

    if (_loggerProvider != null)
        context.LoggerProvider = _loggerProvider;

    context.Conventions.ThrowsIfInvalidPrimaryKeyDefinition<TEntity>();
}
@johelvisguzman johelvisguzman added the enhancement Updates existing code to be simpler, more powerful or adds somehow to existing functionality label Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Updates existing code to be simpler, more powerful or adds somehow to existing functionality
Projects
None yet
Development

No branches or pull requests

1 participant