ModelConfigurationBuilder Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides a simple API surface for setting defaults and configuring conventions before they run.
public class ModelConfigurationBuilder
type ModelConfigurationBuilder = class
Public Class ModelConfigurationBuilder
- Inheritance
-
ModelConfigurationBuilder
Remarks
You can use ModelConfigurationBuilder to configure the conventions for a context by overriding ConfigureConventions(ModelConfigurationBuilder) on your derived context. Alternatively you can create the model externally and set it on a DbContextOptions instance that is passed to the context constructor.
See Pre-convention model building in EF Core for more information and examples.
Constructors
ModelConfigurationBuilder(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. |
ModelConfigurationBuilder(ConventionSet) |
Initializes a new instance of the ModelConfigurationBuilder. |
Properties
Conventions |
Gets the builder for the conventions that will be used in the model. |
ModelConfiguration |
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. |
Methods
ComplexProperties(Type) |
Marks the given and derived types as corresponding to complex properties. |
ComplexProperties<TProperty>() |
Marks the given and derived types as corresponding to complex properties. |
CreateModelBuilder(ModelDependencies) |
Creates the configured ModelBuilder used to create the model. This is done automatically when using OnModelCreating(ModelBuilder); this method allows it to be run explicitly in cases where the automatic execution is not possible. |
DefaultTypeMapping(Type, Action<TypeMappingConfigurationBuilder>) |
Marks the given type as a scalar, even when used outside of entity types. This allows values of this type to be used in queries that are not referencing property of this type. |
DefaultTypeMapping(Type) |
Marks the given type as a scalar, even when used outside of entity types. This allows values of this type to be used in queries that are not referencing property of this type. |
DefaultTypeMapping<TScalar>() |
Marks the given type as a scalar, even when used outside of entity types. This allows values of this type to be used in queries that are not referencing property of this type. |
DefaultTypeMapping<TScalar>(Action<TypeMappingConfigurationBuilder<TScalar>>) |
Marks the given type as a scalar, even when used outside of entity types. This allows values of this type to be used in queries that are not referencing property of this type. |
IgnoreAny(Type) |
Prevents the conventions from the given type from discovering properties of the given or derived types. |
IgnoreAny<T>() |
Prevents the conventions from the given type from discovering properties of the given or derived types. |
Properties(Type, Action<PropertiesConfigurationBuilder>) |
Marks the given and derived types as corresponding to entity type properties. |
Properties(Type) |
Marks the given and derived types as corresponding to entity type properties. |
Properties<TProperty>() |
Marks the given and derived types as corresponding to entity type properties. |
Properties<TProperty>(Action<PropertiesConfigurationBuilder<TProperty>>) |
Marks the given and derived types as corresponding to entity type properties. |
Applies to
Entity Framework