Sdílet prostřednictvím


IConventionPropertyBuilder Interface

Definition

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

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

public interface IConventionPropertyBuilder : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionAnnotatableBuilder
public interface IConventionPropertyBuilder : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBaseBuilder
public interface IConventionPropertyBuilder : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBaseBuilder<Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder>
type IConventionPropertyBuilder = interface
    interface IConventionAnnotatableBuilder
type IConventionPropertyBuilder = interface
    interface IConventionPropertyBaseBuilder
    interface IConventionAnnotatableBuilder
type IConventionPropertyBuilder = interface
    interface IConventionPropertyBaseBuilder<IConventionPropertyBuilder>
    interface IConventionAnnotatableBuilder
Public Interface IConventionPropertyBuilder
Implements IConventionAnnotatableBuilder
Public Interface IConventionPropertyBuilder
Implements IConventionPropertyBaseBuilder
Public Interface IConventionPropertyBuilder
Implements IConventionPropertyBaseBuilder(Of IConventionPropertyBuilder)
Implements

Remarks

See Model building conventions for more information and examples.

Properties

Metadata

Gets the property being configured.

ModelBuilder

Gets the model builder.

(Inherited from IConventionAnnotatableBuilder)

Methods

AfterSave(Nullable<PropertySaveBehavior>, Boolean)

Configures whether this property can be modified after the entity is saved to the database.

BeforeSave(Nullable<PropertySaveBehavior>, Boolean)

Configures whether this property can be modified before the entity is saved to the database.

CanRemoveAnnotation(String, Boolean)

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

(Inherited from IConventionAnnotatableBuilder)
CanSetAfterSave(Nullable<PropertySaveBehavior>, Boolean)

Returns a value indicating whether the ability to be modified after the entity is saved to the database can be configured for this property from the current configuration source.

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)
CanSetBeforeSave(Nullable<PropertySaveBehavior>, Boolean)

Returns a value indicating whether the ability to be modified before the entity is saved to the database can be configured for this property from the current configuration source.

CanSetConversion(Type, Boolean)

Returns a value indicating whether the given type to convert values to and from can be configured for this property from the current configuration source.

CanSetConversion(ValueConverter, Boolean)

Returns a value indicating whether the ValueConverter can be configured for this property from the current configuration source.

CanSetConverter(Type, Boolean)

Returns a value indicating whether the ValueConverter can be configured for this property from the current configuration source.

CanSetElementType(Type, Boolean)

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.

CanSetField(FieldInfo, Boolean)

Returns a value indicating whether the backing field can be set for this property from the current configuration source.

CanSetField(String, Boolean)

Returns a value indicating whether the backing field can be set for this property from the current configuration source.

CanSetIsConcurrencyToken(Nullable<Boolean>, Boolean)

Returns a value indicating whether the property can be configured as a concurrency token from the current configuration source.

CanSetIsRequired(Nullable<Boolean>, Boolean)

Returns a value indicating whether this property requiredness can be configured from the current configuration source.

CanSetIsUnicode(Nullable<Boolean>, Boolean)

Returns a value indicating whether the property can be configured as capable of persisting unicode characters from the current configuration source.

CanSetKeyValueComparer(ValueComparer, Boolean)
Obsolete.

Returns a value indicating whether the given ValueComparer can be configured for this property from the current configuration source.

CanSetMaxLength(Nullable<Int32>, Boolean)

Returns a value indicating whether the maximum length of data allowed can be set for this property from the current configuration source.

CanSetPrecision(Nullable<Int32>, Boolean)

Returns a value indicating whether the precision of data allowed can be set for this property from the current configuration source.

CanSetPropertyAccessMode(Nullable<PropertyAccessMode>, Boolean)

Returns a value indicating whether the PropertyAccessMode can be set for this property from the current configuration source.

CanSetProviderValueComparer(Type, Boolean)

Returns a value indicating whether the given ValueComparer can be configured for this property from the current configuration source.

CanSetProviderValueComparer(ValueComparer, Boolean)

Returns a value indicating whether the given ValueComparer can be configured for this property from the current configuration source.

CanSetScale(Nullable<Int32>, Boolean)

Returns a value indicating whether the scale of data allowed can be set for this property from the current configuration source.

CanSetSentinel(Object, Boolean)

Returns a value indicating whether the sentinel can be set for this property from the current configuration source.

CanSetStructuralValueComparer(ValueComparer, Boolean)
Obsolete.

Returns a value indicating whether the given ValueComparer can be configured for this property from the current configuration source.

CanSetTypeMapping(CoreTypeMapping, Boolean)

Returns a value indicating whether the given CoreTypeMapping can be configured for this property from the current configuration source.

CanSetValueComparer(Type, Boolean)

Returns a value indicating whether the given ValueComparer can be configured for this property from the current configuration source.

CanSetValueComparer(ValueComparer, Boolean)

Returns a value indicating whether the given ValueComparer can be configured for this property from the current configuration source.

CanSetValueGenerated(Nullable<ValueGenerated>, Boolean)

Returns a value indicating whether the property value generation can be configured from the current configuration source.

CanSetValueGenerator(Func<IProperty,IEntityType,ValueGenerator>, Boolean)

Returns a value indicating whether the ValueGenerator can be configured for this property from the current configuration source.

CanSetValueGenerator(Func<IProperty,ITypeBase,ValueGenerator>, Boolean)

Returns a value indicating whether the ValueGenerator can be configured for this property from the current configuration source.

CanSetValueGeneratorFactory(Type, Boolean)

Returns a value indicating whether the ValueGeneratorFactory can be configured for this property from the current configuration source.

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.

(Inherited from IConventionPropertyBaseBuilder<TBuilder>)
HasConversion(Type, Boolean)

Configures the property so that the property value is converted to the given type before writing to the database and converted back when reading from the database.

HasConversion(ValueConverter, Boolean)

Configures the property so that the property value is converted to and from the database using the given ValueConverter.

HasConverter(Type, Boolean)

Configures the property so that the property value is converted to and from the database using the given ValueConverter.

HasField(FieldInfo, Boolean)

Sets the backing field to use for this property.

HasField(String, Boolean)

Sets the backing field to use for this property.

HasKeyValueComparer(ValueComparer, Boolean)
Obsolete.

Configures the ValueComparer to be used for key comparisons for this property.

HasMaxLength(Nullable<Int32>, Boolean)

Configures the maximum length of data that can be stored in this property.

HasNoAnnotation(String, Boolean)

Removes the annotation with the given name from this object.

(Inherited from IConventionPropertyBaseBuilder<TBuilder>)
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.

(Inherited from IConventionPropertyBaseBuilder<TBuilder>)
HasPrecision(Nullable<Int32>, Boolean)

Configures the precision of the property.

HasProviderValueComparer(Type, Boolean)

Configures the ValueComparer to use for the provider values for this property.

HasProviderValueComparer(ValueComparer, Boolean)

Configures the ValueComparer to use for the provider values for this property.

HasScale(Nullable<Int32>, Boolean)

Configures the scale of the property.

HasSentinel(Object, Boolean)

Configures the value that will be used to determine if the property has been set or not. If the property is set to the sentinel value, then it is considered not set. By default, the sentinel value is the CLR default value for the type of the property.

HasStructuralValueComparer(ValueComparer, Boolean)
Obsolete.

Configures the ValueComparer to be used for structural comparisons for this property.

HasTypeMapping(CoreTypeMapping, Boolean)

Configures the CoreTypeMapping for this property.

HasValueComparer(Type, Boolean)

Configures the ValueComparer for this property.

HasValueComparer(ValueComparer, Boolean)

Configures the ValueComparer for this property.

HasValueGenerator(Func<IProperty,IEntityType,ValueGenerator>, Boolean)

Configures the ValueGenerator that will generate values for this property.

HasValueGenerator(Func<IProperty,ITypeBase,ValueGenerator>, Boolean)

Configures the ValueGenerator that will generate values for this property.

HasValueGenerator(Type, Boolean)

Configures the ValueGenerator that will generate values for this property.

HasValueGeneratorFactory(Type, Boolean)

Configures the ValueGeneratorFactory for creating a ValueGenerator that will generate values for this property.

IsConcurrencyToken(Nullable<Boolean>, Boolean)

Configures whether this property should be used as a concurrency token. When a property is configured as a concurrency token the value in the database will be checked when an instance of this entity type is updated or deleted during SaveChanges() to ensure it has not changed since the instance was retrieved from the database. If it has changed, an exception will be thrown and the changes will not be applied to the database.

IsRequired(Nullable<Boolean>, Boolean)

Configures whether this property must have a value assigned or null is a valid value. A property can only be configured as non-required if it is based on a CLR type that can be assigned null.

IsUnicode(Nullable<Boolean>, Boolean)

Configures whether the property as capable of persisting unicode characters.

RemoveAnnotation(String, Boolean)
Obsolete.

Removes the annotation with the given name from this object.

(Inherited from IConventionAnnotatableBuilder)
SetElementType(Type, Boolean)

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.

SetOrRemoveAnnotation(String, Object, Boolean)
Obsolete.

Sets or removes the annotation stored under the given name.

(Inherited from IConventionAnnotatableBuilder)
UsePropertyAccessMode(Nullable<PropertyAccessMode>, Boolean)

Sets the PropertyAccessMode to use for this property.

ValueGenerated(Nullable<ValueGenerated>, Boolean)

Sets a value indicating when a value for this property will be generated by the database. Even when the property is set to be generated by the database, EF may still attempt to save a specific value (rather than having one generated by the database) when the entity is added and a value is assigned, or the property is marked as modified for an existing entity. See GetBeforeSaveBehavior() and GetAfterSaveBehavior() for more information and examples.

Extension Methods

CanSetIsVector(IConventionPropertyBuilder, DistanceFunction, Int32, Boolean)

Returns a value indicating whether the vector type can be set.

CanSetJsonProperty(IConventionPropertyBuilder, String, Boolean)

Returns a value indicating whether the given property name can be set.

IsVector(IConventionPropertyBuilder, DistanceFunction, Int32, Boolean)

Configures the property as a vector for Azure Cosmos DB.

ToJsonProperty(IConventionPropertyBuilder, String, Boolean)

Configures the property name that the property is mapped to when targeting Azure Cosmos. If an empty string is supplied then the property will not be persisted.

CanSetCollation(IConventionPropertyBuilder, String, Boolean)

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

CanSetColumnName(IConventionPropertyBuilder, String, StoreObjectIdentifier, Boolean)

Returns a value indicating whether the given column for a particular table-like store object can be set for the property.

CanSetColumnName(IConventionPropertyBuilder, String, Boolean)

Returns a value indicating whether the given column can be set for the property.

CanSetColumnOrder(IConventionPropertyBuilder, Nullable<Int32>, Boolean)

Gets a value indicating whether the given column order can be set for the property.

CanSetColumnType(IConventionPropertyBuilder, String, Boolean)

Returns a value indicating whether the given data type can be set for the property.

CanSetComment(IConventionPropertyBuilder, Object, Boolean)

Returns a value indicating whether the given value can be set as comment for the column.

CanSetComment(IConventionPropertyBuilder, String, Boolean)

Returns a value indicating whether the given value can be set as comment for the column.

CanSetComputedColumnSql(IConventionPropertyBuilder, String, Boolean)

Returns a value indicating whether the given computed value SQL expression can be set for the column.

CanSetDefaultValue(IConventionPropertyBuilder, Object, Boolean)

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

CanSetDefaultValueSql(IConventionPropertyBuilder, String, Boolean)

Returns a value indicating whether the given default value expression can be set for the column.

CanSetIsFixedLength(IConventionPropertyBuilder, Nullable<Boolean>, Boolean)

Returns a value indicating whether the property can be configured as being fixed length or not.

CanSetIsStoredComputedColumn(IConventionPropertyBuilder, Nullable<Boolean>, Boolean)

Returns a value indicating whether the given computed column type can be set for the column.

CanSetJsonPropertyName(IConventionPropertyBuilder, String, Boolean)

Returns a value indicating whether the given value can be used as a JSON property name for a given entity property.

HasColumnName(IConventionPropertyBuilder, String, StoreObjectIdentifier, Boolean)

Configures the column that the property maps to in a particular table-like store object.

HasColumnName(IConventionPropertyBuilder, String, Boolean)

Configures the column that the property maps to when targeting a relational database.

HasColumnOrder(IConventionPropertyBuilder, Nullable<Int32>, Boolean)

Configures the order of the column the property is mapped to.

HasColumnType(IConventionPropertyBuilder, String, Boolean)

Configures the data type of the column that the property maps to when targeting a relational database. This should be the complete type name, including precision, scale, length, etc.

HasComment(IConventionPropertyBuilder, String, Boolean)

Configures a comment to be applied to the column

HasComputedColumnSql(IConventionPropertyBuilder, String, Boolean)

Configures the property to map to a computed column when targeting a relational database.

HasDefaultValue(IConventionPropertyBuilder, Object, Boolean)

Configures the default value for the column that the property maps to when targeting a relational database.

HasDefaultValueSql(IConventionPropertyBuilder, String, Boolean)

Configures the default value expression for the column that the property maps to when targeting a relational database.

HasJsonPropertyName(IConventionPropertyBuilder, String, Boolean)

Configures the property of an entity mapped to a JSON column, mapping the entity property to a specific JSON property, rather than using the entity property name.

IsFixedLength(IConventionPropertyBuilder, Nullable<Boolean>, Boolean)

Configures the property as capable of storing only fixed-length data, such as strings.

IsStoredComputedColumn(IConventionPropertyBuilder, Nullable<Boolean>, Boolean)

Configures the property to map to a computed column of the given type when targeting a relational database.

UseCollation(IConventionPropertyBuilder, String, Boolean)

Configures the property to use the given collation. The database column will be created with the given collation, and it will be used implicitly in all collation-sensitive operations.

CanSetGeometricDimension(IConventionPropertyBuilder, String, Boolean)

Returns a value indicating whether the given value can be set as the dimension for the column.

CanSetSrid(IConventionPropertyBuilder, Nullable<Int32>, Boolean)

Returns a value indicating whether the given value can be set as the SRID for the column.

ForSqliteHasDimension(IConventionPropertyBuilder, String, Boolean)
Obsolete.

Configures the dimension of the column that the property maps to when targeting SQLite.

ForSqliteHasSrid(IConventionPropertyBuilder, Nullable<Int32>, Boolean)
Obsolete.

Configures the SRID of the column that the property maps to when targeting SQLite.

HasGeometricDimension(IConventionPropertyBuilder, String, Boolean)

Configures the dimension of the column that the property maps to when targeting SQLite.

HasSrid(IConventionPropertyBuilder, Nullable<Int32>, Boolean)

Configures the SRID of the column that the property maps to when targeting SQLite.

CanSetHiLoSequence(IConventionPropertyBuilder, String, String, Boolean)

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

CanSetIdentityColumnIncrement(IConventionPropertyBuilder, Nullable<Int32>, StoreObjectIdentifier, Boolean)

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

CanSetIdentityColumnIncrement(IConventionPropertyBuilder, Nullable<Int32>, Boolean)

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

CanSetIdentityColumnSeed(IConventionPropertyBuilder, Nullable<Int32>, Boolean)

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

CanSetIdentityColumnSeed(IConventionPropertyBuilder, Nullable<Int64>, StoreObjectIdentifier, Boolean)

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

CanSetIdentityColumnSeed(IConventionPropertyBuilder, Nullable<Int64>, Boolean)

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

CanSetIsSparse(IConventionPropertyBuilder, Nullable<Boolean>, Boolean)

Returns a value indicating whether the property's column can be configured as sparse when targeting SQL Server.

CanSetSequence(IConventionPropertyBuilder, String, String, Boolean)

Returns a value indicating whether the given name and schema can be set for the key value generation sequence.

CanSetValueGenerationStrategy(IConventionPropertyBuilder, Nullable<SqlServerValueGenerationStrategy>, StoreObjectIdentifier, Boolean)

Returns a value indicating whether the given value can be set as the value generation strategy for a particular table.

CanSetValueGenerationStrategy(IConventionPropertyBuilder, Nullable<SqlServerValueGenerationStrategy>, Boolean)

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

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

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

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

Configures the increment for SQL Server IDENTITY.

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

Configures the seed for SQL Server IDENTITY.

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

Configures the value generation strategy for the key property, when targeting SQL Server.

HasHiLoSequence(IConventionPropertyBuilder, String, String, Boolean)

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

HasIdentityColumnIncrement(IConventionPropertyBuilder, Nullable<Int32>, StoreObjectIdentifier, Boolean)

Configures the increment for SQL Server IDENTITY for a particular table.

HasIdentityColumnIncrement(IConventionPropertyBuilder, Nullable<Int32>, Boolean)

Configures the increment for SQL Server IDENTITY.

HasIdentityColumnSeed(IConventionPropertyBuilder, Nullable<Int32>, Boolean)

Configures the seed for SQL Server IDENTITY.

HasIdentityColumnSeed(IConventionPropertyBuilder, Nullable<Int64>, StoreObjectIdentifier, Boolean)

Configures the seed for SQL Server IDENTITY for a particular table.

HasIdentityColumnSeed(IConventionPropertyBuilder, Nullable<Int64>, Boolean)

Configures the seed for SQL Server IDENTITY.

HasSequence(IConventionPropertyBuilder, String, String, Boolean)

Configures the database sequence used for the key value generation pattern to generate values for the key property, when targeting SQL Server.

HasValueGenerationStrategy(IConventionPropertyBuilder, Nullable<SqlServerValueGenerationStrategy>, StoreObjectIdentifier, Boolean)

Configures the value generation strategy for the key property, when targeting SQL Server for a particular table.

HasValueGenerationStrategy(IConventionPropertyBuilder, Nullable<SqlServerValueGenerationStrategy>, Boolean)

Configures the value generation strategy for the key property, when targeting SQL Server.

IsSparse(IConventionPropertyBuilder, Nullable<Boolean>, Boolean)

Configures whether the property's column is created as sparse when targeting SQL Server.

Applies to