efcore
efcore copied to clipboard
Add a service to configure conventions
It will be similar to IModelCustomizer:
public interface IConventionCustomizer
{
/// <summary>
/// Sets model defaults and configures conventions before they run for a given context.
/// </summary>
/// <remarks>
/// If any instance data from <paramref name="context" /> is
/// used when building the model, then the implementation of <see cref="IModelCacheKeyFactory.Create(DbContext, bool)" />
/// also needs to be updated to ensure the model is cached correctly.
/// </remarks>
/// <param name="configurationBuilder">
/// The builder being used to set defaults and configure conventions that will be used to build the model for this context.
/// </param>
/// <param name="context">
/// The context instance that the model is being created for.
/// </param>
void Customize(ModelConfigurationBuilder configurationBuilder, DbContext context);
}
The default implementation will call context.ConfigureConventions(configurationBuilder);
Is it different from IConventionSetPlugin ?
It's not a plugin service, so it can be replaced using ReplaceService. Also, it gets a ModelConfigurationBuilder, so it can be used to apply other pre-convention configuration.