Skip to content

Use a callback to configure conventions for a context  #693

@johelvisguzman

Description

@johelvisguzman

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementUpdates existing code to be simpler, more powerful or adds somehow to existing functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions