Class ConventionSetBuilder
- Namespace
- Microsoft.EntityFrameworkCore.Metadata.Builders
- Assembly
- Microsoft.EntityFrameworkCore.dll
Provides a simple API surface for configuring conventions.
public class ConventionSetBuilder
- Inheritance
-
ConventionSetBuilder
- Inherited Members
Remarks
Instances of this class are returned from methods when using the ModelConfigurationBuilder API and it is not designed to be directly constructed in your application code.
Constructors
ConventionSetBuilder(ConventionSet, IServiceProvider)
This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.
[EntityFrameworkInternal]
public ConventionSetBuilder(ConventionSet conventionSet, IServiceProvider serviceProvider)
Parameters
conventionSet
ConventionSetserviceProvider
IServiceProvider
Methods
Add(Func<IServiceProvider, IConvention>)
Adds a convention to the set.
public virtual void Add(Func<IServiceProvider, IConvention> conventionFactory)
Parameters
conventionFactory
Func<IServiceProvider, IConvention>The factory that creates the convention.
Remove(Type)
Removes the convention of the given type.
public virtual void Remove(Type conventionType)
Parameters
conventionType
TypeThe convention type to remove.
Remove<TImplementaion>()
Remove the convention of the given type.
public virtual void Remove<TImplementaion>() where TImplementaion : IConvention
Type Parameters
TImplementaion
The type of convention to remove
Replace<TImplementation>(Func<IServiceProvider, TImplementation>)
Replaces an existing convention with a derived convention. Also registers the new convention for any convention types not implemented by the existing convention.
public virtual void Replace<TImplementation>(Func<IServiceProvider, TImplementation> conventionFactory) where TImplementation : IConvention
Parameters
conventionFactory
Func<IServiceProvider, TImplementation>The factory that creates the new convention.
Type Parameters
TImplementation
The type of the old convention.