共用方式為


IConventionModelBuilder Interface

Definition

Provides a simple API surface for configuring an IConventionModelBuilder from conventions.

This interface is typically used by database providers (and other extensions). It is generally not used in application code.

public interface IConventionModelBuilder : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionAnnotatableBuilder
type IConventionModelBuilder = interface
    interface IConventionAnnotatableBuilder
Public Interface IConventionModelBuilder
Implements IConventionAnnotatableBuilder
Implements

Remarks

See Model building conventions for more information and examples.

Properties

Metadata

Gets the model being configured.

ModelBuilder

Gets the model builder.

(Inherited from IConventionAnnotatableBuilder)

Methods

CanHaveEntity(String, Boolean)

Returns a value indicating whether the given entity type can be added to the model.

CanHaveEntity(Type, Boolean)

Returns a value indicating whether the given entity type can be added to the model.

CanHaveSharedTypeEntity(String, Type, Boolean)

Returns a value indicating whether the given entity type can be added to the model.

CanIgnore(String, Boolean)

Returns a value indicating whether the given entity type name can be ignored from the current configuration source

CanIgnore(Type, Boolean)

Returns a value indicating whether the given entity type can be ignored from the current configuration source.

CanRemoveAnnotation(String, Boolean)

Returns a value indicating whether an annotation with the given name can be removed using this configuration source.

(Inherited from IConventionAnnotatableBuilder)
CanRemoveEntity(IConventionEntityType, Boolean)

Returns a value indicating whether the entity type can be removed from the model.

CanSetAnnotation(String, Object, Boolean)

Returns a value indicating whether an annotation with the given name and value can be set from this configuration source.

(Inherited from IConventionAnnotatableBuilder)
CanSetChangeTrackingStrategy(Nullable<ChangeTrackingStrategy>, Boolean)

Returns a value indicating whether the given change tracking strategy can be set from the current configuration source

CanSetEmbeddedDiscriminatorName(String, Boolean)

Returns a value indicating whether the given name can be set from the current configuration source

CanSetPropertyAccessMode(Nullable<PropertyAccessMode>, Boolean)

Returns a value indicating whether the given property access mode can be set from the current configuration source

ComplexType(Type, Boolean)

Marks a type as complex. All references to this type will be configured as complex properties.

Entity(String, Nullable<Boolean>, Boolean)

Returns an object that can be used to configure a given entity type in the model. If an entity type with the provided name is not already part of the model, a new shadow entity type will be added to the model.

Entity(String, String, IConventionEntityType, Boolean)

Returns an object that can be used to configure a given entity type with defining navigation. If an entity type with the provided name is not already part of the model, a new shadow entity type will be added to the model.

Entity(Type, Nullable<Boolean>, Boolean)

Returns an object that can be used to configure a given entity type in the model. If an entity type with the provided type is not already part of the model, a new entity type will be added to the model.

Entity(Type, String, IConventionEntityType, Boolean)

Returns an object that can be used to configure a given entity type with defining navigation. If an entity type with the provided type is not already part of the model, a new entity type will be added to the model.

HasAnnotation(String, Object, Boolean)

Sets the annotation stored under the given name. Overwrites the existing annotation if an annotation with the specified name already exists with same or lower ConfigurationSource.

HasChangeTrackingStrategy(Nullable<ChangeTrackingStrategy>, Boolean)

Configures the default ChangeTrackingStrategy to be used for this model. This strategy indicates how the context detects changes to properties for an instance of an entity type.

HasEmbeddedDiscriminatorName(String, Boolean)

Sets the name to use for discriminator properties embedded in JSON documents. The default is "$type".

HasNoAnnotation(String, Boolean)

Removes the annotation with the given name from this object.

HasNoEntityType(IConventionEntityType, Boolean)

Removes the given entity type from the model.

HasNonNullAnnotation(String, Object, Boolean)

Sets the annotation stored under the given name. Overwrites the existing annotation if an annotation with the specified name already exists with same or lower ConfigurationSource. Removes the annotation if null value is specified.

Ignore(String, Boolean)

Excludes the given entity type name from the model and prevents it from being added by convention.

Ignore(Type, Boolean)

Excludes the given entity type from the model and prevents it from being added by convention.

IsIgnored(String, Boolean)

Indicates whether the given entity type name is ignored for the current configuration source.

IsIgnored(Type, Boolean)

Indicates whether the given entity type name is ignored for the current configuration source.

Owned(Type, Boolean)

Marks an entity type as owned. All references to this type will be configured as separate owned type instances.

RemoveAnnotation(String, Boolean)
Obsolete.

Removes the annotation with the given name from this object.

(Inherited from IConventionAnnotatableBuilder)
SetOrRemoveAnnotation(String, Object, Boolean)
Obsolete.

Sets or removes the annotation stored under the given name.

(Inherited from IConventionAnnotatableBuilder)
SharedTypeEntity(String, Type, Nullable<Boolean>, Boolean)

Returns an object that can be used to configure a given shared type entity type in the model.

UsePropertyAccessMode(Nullable<PropertyAccessMode>, Boolean)

Sets the PropertyAccessMode to use for all properties of this entity type.

Extension Methods

CanSetDefaultContainer(IConventionModelBuilder, String, Boolean)

Returns a value indicating whether the given container name can be set as default.

CanSetThroughput(IConventionModelBuilder, Nullable<Int32>, Boolean, Boolean)

Returns a value indicating whether the given throughput can be set.

HasDefaultContainer(IConventionModelBuilder, String, Boolean)

Configures the default container name that will be used if no name is explicitly configured for an entity type.

HasThroughput(IConventionModelBuilder, Nullable<Int32>, Boolean, Boolean)

Configures the provisioned throughput.

CanSetCollation(IConventionModelBuilder, String, Boolean)

Returns a value indicating whether the given collation can be set as default.

CanSetDefaultSchema(IConventionModelBuilder, String, Boolean)

Returns a value indicating whether the given schema can be set as default.

CanSetMaxIdentifierLength(IConventionModelBuilder, Nullable<Int32>, Boolean)

Returns a value indicating whether the maximum length allowed for store identifiers can be set.

HasDbFunction(IConventionModelBuilder, MethodInfo, Boolean)

Configures a relational database function.

HasDbFunction(IConventionModelBuilder, String, Type, Boolean)

Configures a relational database function.

HasDefaultSchema(IConventionModelBuilder, String, Boolean)

Configures the default schema that database objects should be created in, if no schema is explicitly configured.

HasMaxIdentifierLength(IConventionModelBuilder, Nullable<Int32>, Boolean)

Configures the maximum length allowed for store identifiers.

HasSequence(IConventionModelBuilder, String, String, Boolean)

Configures a database sequence when targeting a relational database.

UseCollation(IConventionModelBuilder, String, Boolean)

Configures the database collation, which will be used by all columns without an explicit collation.

CanSetDatabaseMaxSize(IConventionModelBuilder, String, Boolean)

Returns a value indicating whether the given value can be set as the maximum size of the database.

CanSetHiLoSequence(IConventionModelBuilder, String, String, Boolean)

Returns a value indicating whether the given name and schema can be set for the hi-lo sequence.

CanSetIdentityColumnIncrement(IConventionModelBuilder, Nullable<Int32>, Boolean)

Returns a value indicating whether the given value can be set as the default increment for SQL Server IDENTITY.

CanSetIdentityColumnSeed(IConventionModelBuilder, Nullable<Int32>, Boolean)

Returns a value indicating whether the given value can be set as the default seed for SQL Server IDENTITY.

CanSetIdentityColumnSeed(IConventionModelBuilder, Nullable<Int64>, Boolean)

Returns a value indicating whether the given value can be set as the default seed for SQL Server IDENTITY.

CanSetPerformanceLevelSql(IConventionModelBuilder, String, Boolean)

Returns a value indicating whether the given value can be set as the performance level of the database.

CanSetServiceTierSql(IConventionModelBuilder, String, Boolean)

Returns a value indicating whether the given value can be set as the service tier of the database.

CanSetValueGenerationStrategy(IConventionModelBuilder, Nullable<SqlServerValueGenerationStrategy>, Boolean)

Returns a value indicating whether the given value can be set as the default value generation strategy.

ForSqlServerHasHiLoSequence(IConventionModelBuilder, String, String, Boolean)
Obsolete.

Configures the database sequence used for the hi-lo pattern to generate values for key properties marked as OnAdd, when targeting SQL Server.

ForSqlServerHasIdentityIncrement(IConventionModelBuilder, Nullable<Int32>, Boolean)
Obsolete.

Configures the default increment for SQL Server IDENTITY.

ForSqlServerHasIdentitySeed(IConventionModelBuilder, Nullable<Int32>, Boolean)
Obsolete.

Configures the default seed for SQL Server IDENTITY.

ForSqlServerHasValueGenerationStrategy(IConventionModelBuilder, Nullable<SqlServerValueGenerationStrategy>, Boolean)
Obsolete.

Configures the default value generation strategy for key properties marked as OnAdd, when targeting SQL Server.

HasDatabaseMaxSize(IConventionModelBuilder, String, Boolean)

Attempts to configure the maximum size for Azure SQL Database.

HasHiLoSequence(IConventionModelBuilder, String, String, Boolean)

Configures the database sequence used for the hi-lo pattern to generate values for key properties marked as OnAdd, when targeting SQL Server.

HasIdentityColumnIncrement(IConventionModelBuilder, Nullable<Int32>, Boolean)

Configures the default increment for SQL Server IDENTITY.

HasIdentityColumnSeed(IConventionModelBuilder, Nullable<Int32>, Boolean)

Configures the default seed for SQL Server IDENTITY.

HasIdentityColumnSeed(IConventionModelBuilder, Nullable<Int64>, Boolean)

Configures the default seed for SQL Server IDENTITY.

HasPerformanceLevelSql(IConventionModelBuilder, String, Boolean)

Attempts to configure the performance level (SERVICE_OBJECTIVE) for Azure SQL Database.

HasServiceTierSql(IConventionModelBuilder, String, Boolean)

Attempts to configure the service tier (EDITION) for Azure SQL Database.

HasValueGenerationStrategy(IConventionModelBuilder, Nullable<SqlServerValueGenerationStrategy>, Boolean)

Configures the default value generation strategy for key properties marked as OnAdd, when targeting SQL Server.

Applies to