Class RelationalPropertyBuilderExtensions
- Namespace
- Microsoft.EntityFrameworkCore
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
Relational database specific extension methods for Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder.
public static class RelationalPropertyBuilderExtensions
- Inheritance
-
RelationalPropertyBuilderExtensions
- Inherited Members
Remarks
See Modeling entity types and relationships for more information and examples.
Methods
CanSetCollation(IConventionPropertyBuilder, string?, bool)
Returns a value indicating whether the given value can be set as the collation.
public static bool CanSetCollation(this IConventionPropertyBuilder propertyBuilder, string? collation, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
collationstringThe collation.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
Remarks
See Database collations for more information and examples.
CanSetColumnName(IConventionPropertyBuilder, string?, in StoreObjectIdentifier, bool)
Returns a value indicating whether the given column for a particular table-like store object can be set for the property.
public static bool CanSetColumnName(this IConventionPropertyBuilder propertyBuilder, string? name, in StoreObjectIdentifier storeObject, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
namestringThe name of the column.
storeObjectStoreObjectIdentifierThe identifier of the store object.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
Remarks
See Modeling entity types and relationships for more information and examples.
CanSetColumnName(IConventionPropertyBuilder, string?, bool)
Returns a value indicating whether the given column can be set for the property.
public static bool CanSetColumnName(this IConventionPropertyBuilder propertyBuilder, string? name, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
namestringThe name of the column.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
Remarks
See Modeling entity types and relationships for more information and examples.
CanSetColumnOrder(IConventionPropertyBuilder, int?, bool)
Gets a value indicating whether the given column order can be set for the property.
public static bool CanSetColumnOrder(this IConventionPropertyBuilder propertyBuilder, int? order, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder of the property being configured.
orderint?The column order.
fromDataAnnotationboolA value indicating whether the configuration was specified using a data annotation.
Returns
CanSetColumnType(IConventionPropertyBuilder, string?, bool)
Returns a value indicating whether the given data type can be set for the property.
public static bool CanSetColumnType(this IConventionPropertyBuilder propertyBuilder, string? typeName, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
typeNamestringThe name of the data type of the column.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
Remarks
See Modeling entity types and relationships for more information and examples.
CanSetComment(IConventionPropertyBuilder, string?, bool)
Returns a value indicating whether the given value can be set as comment for the column.
public static bool CanSetComment(this IConventionPropertyBuilder propertyBuilder, string? comment, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
commentstringThe comment for the column.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
Remarks
See Modeling entity types and relationships for more information and examples.
CanSetComputedColumnSql(IConventionPropertyBuilder, string?, bool)
Returns a value indicating whether the given computed value SQL expression can be set for the column.
public static bool CanSetComputedColumnSql(this IConventionPropertyBuilder propertyBuilder, string? sql, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
sqlstringThe SQL expression that computes values for the column.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
Remarks
See Database default values for more information and examples.
CanSetDefaultValue(IConventionPropertyBuilder, object?, bool)
Returns a value indicating whether the given value can be set as default for the column.
public static bool CanSetDefaultValue(this IConventionPropertyBuilder propertyBuilder, object? value, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
valueobjectThe default value of the column.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
Remarks
See Database default values for more information and examples.
CanSetDefaultValueSql(IConventionPropertyBuilder, string?, bool)
Returns a value indicating whether the given default value expression can be set for the column.
public static bool CanSetDefaultValueSql(this IConventionPropertyBuilder propertyBuilder, string? sql, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
sqlstringThe SQL expression for the default value of the column.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
Remarks
See Database default values for more information and examples.
CanSetIsFixedLength(IConventionPropertyBuilder, bool?, bool)
Returns a value indicating whether the property can be configured as being fixed length or not.
public static bool CanSetIsFixedLength(this IConventionPropertyBuilder propertyBuilder, bool? fixedLength, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
fixedLengthbool?A value indicating whether the property is constrained to fixed length values.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
Remarks
See Modeling entity types and relationships for more information and examples.
CanSetIsStoredComputedColumn(IConventionPropertyBuilder, bool?, bool)
Returns a value indicating whether the given computed column type can be set for the column.
public static bool CanSetIsStoredComputedColumn(this IConventionPropertyBuilder propertyBuilder, bool? stored, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
storedbool?If true, the computed value is calculated on row modification and stored in the database like a regular column. If false, the value is computed when the value is read, and does not occupy any actual storage. null selects the database provider default.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
Remarks
See Database default values for more information and examples.
CanSetJsonPropertyName(IConventionPropertyBuilder, string?, bool)
Returns a value indicating whether the given value can be used as a JSON property name for a given entity property.
public static bool CanSetJsonPropertyName(this IConventionPropertyBuilder propertyBuilder, string? name, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
namestringJSON property name to be used.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
HasColumnName(IConventionPropertyBuilder, string?, in StoreObjectIdentifier, bool)
Configures the column that the property maps to in a particular table-like store object.
public static IConventionPropertyBuilder? HasColumnName(this IConventionPropertyBuilder propertyBuilder, string? name, in StoreObjectIdentifier storeObject, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
namestringThe name of the column.
storeObjectStoreObjectIdentifierThe identifier of the store object.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied, null otherwise.
Remarks
See Modeling entity types and relationships for more information and examples.
HasColumnName(IConventionPropertyBuilder, string?, bool)
Configures the column that the property maps to when targeting a relational database.
public static IConventionPropertyBuilder? HasColumnName(this IConventionPropertyBuilder propertyBuilder, string? name, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
namestringThe name of the column.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied, null otherwise.
Remarks
See Modeling entity types and relationships for more information and examples.
HasColumnName(PropertyBuilder, string?)
Configures the column that the property maps to when targeting a relational database.
public static PropertyBuilder HasColumnName(this PropertyBuilder propertyBuilder, string? name)
Parameters
propertyBuilderPropertyBuilderThe builder for the property being configured.
namestringThe name of the column.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Modeling entity types and relationships for more information and examples.
HasColumnName<TProperty>(PropertyBuilder<TProperty>, string?)
Configures the column that the property maps to when targeting a relational database.
public static PropertyBuilder<TProperty> HasColumnName<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, string? name)
Parameters
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
namestringThe name of the column.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TPropertyThe type of the property being configured.
Remarks
See Modeling entity types and relationships for more information and examples.
HasColumnOrder(IConventionPropertyBuilder, int?, bool)
Configures the order of the column the property is mapped to.
public static IConventionPropertyBuilder? HasColumnOrder(this IConventionPropertyBuilder propertyBuilder, int? order, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder of the property being configured.
orderint?The column order.
fromDataAnnotationboolA value indicating whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied, null otherwise.
HasColumnOrder(PropertyBuilder, int?)
Configures the order of the column the property is mapped to.
public static PropertyBuilder HasColumnOrder(this PropertyBuilder propertyBuilder, int? order)
Parameters
propertyBuilderPropertyBuilderThe builder of the property being configured.
orderint?The column order.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
HasColumnOrder<TProperty>(PropertyBuilder<TProperty>, int?)
Configures the order of the column the property is mapped to.
public static PropertyBuilder<TProperty> HasColumnOrder<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, int? order)
Parameters
propertyBuilderPropertyBuilder<TProperty>The builder of the property being configured.
orderint?The column order.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TProperty
HasColumnType(IConventionPropertyBuilder, string?, bool)
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.
public static IConventionPropertyBuilder? HasColumnType(this IConventionPropertyBuilder propertyBuilder, string? typeName, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
typeNamestringThe name of the data type of the column.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied, null otherwise.
Remarks
See Modeling entity types and relationships for more information and examples.
HasColumnType(PropertyBuilder, string?)
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.
public static PropertyBuilder HasColumnType(this PropertyBuilder propertyBuilder, string? typeName)
Parameters
propertyBuilderPropertyBuilderThe builder for the property being configured.
typeNamestringThe name of the data type of the column.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Modeling entity types and relationships for more information and examples.
HasColumnType<TProperty>(PropertyBuilder<TProperty>, string?)
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.
public static PropertyBuilder<TProperty> HasColumnType<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, string? typeName)
Parameters
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
typeNamestringThe name of the data type of the column.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TPropertyThe type of the property being configured.
Remarks
See Modeling entity types and relationships for more information and examples.
HasComment(IConventionPropertyBuilder, string?, bool)
Configures a comment to be applied to the column
public static IConventionPropertyBuilder? HasComment(this IConventionPropertyBuilder propertyBuilder, string? comment, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
commentstringThe comment for the column.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied, null otherwise.
Remarks
See Modeling entity types and relationships for more information and examples.
HasComment(PropertyBuilder, string?)
Configures a comment to be applied to the column
public static PropertyBuilder HasComment(this PropertyBuilder propertyBuilder, string? comment)
Parameters
propertyBuilderPropertyBuilderThe builder for the property being configured.
commentstringThe comment for the column.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Modeling entity types and relationships for more information and examples.
HasComment<TProperty>(PropertyBuilder<TProperty>, string?)
Configures a comment to be applied to the column
public static PropertyBuilder<TProperty> HasComment<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, string? comment)
Parameters
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
commentstringThe comment for the column.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TPropertyThe type of the property being configured.
Remarks
See Modeling entity types and relationships for more information and examples.
HasComputedColumnSql(IConventionPropertyBuilder, string?, bool)
Configures the property to map to a computed column when targeting a relational database.
public static IConventionPropertyBuilder? HasComputedColumnSql(this IConventionPropertyBuilder propertyBuilder, string? sql, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
sqlstringThe SQL expression that computes values for the column.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied, null otherwise.
Remarks
See Database default values for more information and examples.
HasComputedColumnSql(PropertyBuilder)
Configures the property to map to a computed column when targeting a relational database.
public static PropertyBuilder HasComputedColumnSql(this PropertyBuilder propertyBuilder)
Parameters
propertyBuilderPropertyBuilderThe builder for the property being configured.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
Remarks
When called with no arguments, this method tells EF that a column is computed without needing to specify the actual SQL used to computed it. This can be useful when mapping EF to an existing database.
See Database default values for more information and examples.
HasComputedColumnSql(PropertyBuilder, string?)
Configures the property to map to a computed column when targeting a relational database.
public static PropertyBuilder HasComputedColumnSql(this PropertyBuilder propertyBuilder, string? sql)
Parameters
propertyBuilderPropertyBuilderThe builder for the property being configured.
sqlstringThe SQL expression that computes values for the column.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Database default values for more information and examples.
HasComputedColumnSql(PropertyBuilder, string?, bool?)
Configures the property to map to a computed column when targeting a relational database.
public static PropertyBuilder HasComputedColumnSql(this PropertyBuilder propertyBuilder, string? sql, bool? stored)
Parameters
propertyBuilderPropertyBuilderThe builder for the property being configured.
sqlstringThe SQL expression that computes values for the column.
storedbool?If true, the computed value is calculated on row modification and stored in the database like a regular column. If false, the value is computed when the value is read, and does not occupy any actual storage. null selects the database provider default.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Database default values for more information and examples.
HasComputedColumnSql<TProperty>(PropertyBuilder<TProperty>)
Configures the property to map to a computed column when targeting a relational database.
public static PropertyBuilder<TProperty> HasComputedColumnSql<TProperty>(this PropertyBuilder<TProperty> propertyBuilder)
Parameters
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TPropertyThe type of the property being configured.
Remarks
When called with no arguments, this method tells EF that a column is computed without needing to specify the actual SQL used to computed it. This can be useful when mapping EF to an existing database.
See Database default values for more information and examples.
HasComputedColumnSql<TProperty>(PropertyBuilder<TProperty>, string?)
Configures the property to map to a computed column when targeting a relational database.
public static PropertyBuilder<TProperty> HasComputedColumnSql<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, string? sql)
Parameters
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
sqlstringThe SQL expression that computes values for the column.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TPropertyThe type of the property being configured.
Remarks
See Database default values for more information and examples.
HasComputedColumnSql<TProperty>(PropertyBuilder<TProperty>, string?, bool?)
Configures the property to map to a computed column when targeting a relational database.
public static PropertyBuilder<TProperty> HasComputedColumnSql<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, string? sql, bool? stored)
Parameters
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
sqlstringThe SQL expression that computes values for the column.
storedbool?If true, the computed value is calculated on row modification and stored in the database like a regular column. If false, the value is computed when the value is read, and does not occupy any actual storage. null selects the database provider default.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TPropertyThe type of the property being configured.
Remarks
See Database default values for more information and examples.
HasDefaultValue(IConventionPropertyBuilder, object?, bool)
Configures the default value for the column that the property maps to when targeting a relational database.
public static IConventionPropertyBuilder? HasDefaultValue(this IConventionPropertyBuilder propertyBuilder, object? value, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
valueobjectThe default value of the column.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied, null otherwise.
Remarks
See Database default values for more information and examples.
HasDefaultValue(PropertyBuilder)
Configures the default value for the column that the property maps to when targeting a relational database.
public static PropertyBuilder HasDefaultValue(this PropertyBuilder propertyBuilder)
Parameters
propertyBuilderPropertyBuilderThe builder for the property being configured.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
Remarks
When called with no argument, this method tells EF that a column has a default value constraint of some sort without needing to specify exactly what it is. This can be useful when mapping EF to an existing database.
See Database default values for more information and examples.
HasDefaultValue(PropertyBuilder, object?)
Configures the default value for the column that the property maps to when targeting a relational database.
public static PropertyBuilder HasDefaultValue(this PropertyBuilder propertyBuilder, object? value)
Parameters
propertyBuilderPropertyBuilderThe builder for the property being configured.
valueobjectThe default value of the column.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Database default values for more information and examples.
HasDefaultValueSql(IConventionPropertyBuilder, string?, bool)
Configures the default value expression for the column that the property maps to when targeting a relational database.
public static IConventionPropertyBuilder? HasDefaultValueSql(this IConventionPropertyBuilder propertyBuilder, string? sql, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
sqlstringThe SQL expression for the default value of the column.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied, null otherwise.
Remarks
See Database default values for more information and examples.
HasDefaultValueSql(PropertyBuilder)
Configures the default value expression for the column that the property maps to when targeting a relational database.
public static PropertyBuilder HasDefaultValueSql(this PropertyBuilder propertyBuilder)
Parameters
propertyBuilderPropertyBuilderThe builder for the property being configured.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
Remarks
When called with no argument, this method tells EF that a column has a default value constraint of some sort without needing to specify exactly what it is. This can be useful when mapping EF to an existing database.
See Database default values for more information and examples.
HasDefaultValueSql(PropertyBuilder, string?)
Configures the default value expression for the column that the property maps to when targeting a relational database.
public static PropertyBuilder HasDefaultValueSql(this PropertyBuilder propertyBuilder, string? sql)
Parameters
propertyBuilderPropertyBuilderThe builder for the property being configured.
sqlstringThe SQL expression for the default value of the column.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Database default values for more information and examples.
HasDefaultValueSql<TProperty>(PropertyBuilder<TProperty>)
Configures the default value expression for the column that the property maps to when targeting a relational database.
public static PropertyBuilder<TProperty> HasDefaultValueSql<TProperty>(this PropertyBuilder<TProperty> propertyBuilder)
Parameters
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TPropertyThe type of the property being configured.
Remarks
When called with no argument, this method tells EF that a column has a default value constraint of some sort without needing to specify exactly what it is. This can be useful when mapping EF to an existing database.
See Database default values for more information and examples.
HasDefaultValueSql<TProperty>(PropertyBuilder<TProperty>, string?)
Configures the default value expression for the column that the property maps to when targeting a relational database.
public static PropertyBuilder<TProperty> HasDefaultValueSql<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, string? sql)
Parameters
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
sqlstringThe SQL expression for the default value of the column.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TPropertyThe type of the property being configured.
Remarks
See Database default values for more information and examples.
HasDefaultValue<TProperty>(PropertyBuilder<TProperty>)
Configures the default value for the column that the property maps to when targeting a relational database.
public static PropertyBuilder<TProperty> HasDefaultValue<TProperty>(this PropertyBuilder<TProperty> propertyBuilder)
Parameters
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TPropertyThe type of the property being configured.
Remarks
When called with no argument, this method tells EF that a column has a default value constraint of some sort without needing to specify exactly what it is. This can be useful when mapping EF to an existing database.
See Database default values for more information and examples.
HasDefaultValue<TProperty>(PropertyBuilder<TProperty>, object?)
Configures the default value for the column that the property maps to when targeting a relational database.
public static PropertyBuilder<TProperty> HasDefaultValue<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, object? value)
Parameters
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
valueobjectThe default value of the column.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TPropertyThe type of the property being configured.
Remarks
See Database default values for more information and examples.
HasJsonPropertyName(IConventionPropertyBuilder, string?, bool)
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.
public static IConventionPropertyBuilder? HasJsonPropertyName(this IConventionPropertyBuilder propertyBuilder, string? name, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
namestringJSON property name to be used.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied, null otherwise.
HasJsonPropertyName(PropertyBuilder, string?)
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.
public static PropertyBuilder HasJsonPropertyName(this PropertyBuilder propertyBuilder, string? name)
Parameters
propertyBuilderPropertyBuilderThe builder for the property being configured.
namestringJSON property name to be used.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
HasJsonPropertyName<TProperty>(PropertyBuilder<TProperty>, string?)
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.
public static PropertyBuilder<TProperty> HasJsonPropertyName<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, string? name)
Parameters
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
namestringJSON property name to be used.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TProperty
IsFixedLength(IConventionPropertyBuilder, bool?, bool)
Configures the property as capable of storing only fixed-length data, such as strings.
public static IConventionPropertyBuilder? IsFixedLength(this IConventionPropertyBuilder propertyBuilder, bool? fixedLength, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
fixedLengthbool?A value indicating whether the property is constrained to fixed length values.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied, null otherwise.
Remarks
See Modeling entity types and relationships for more information and examples.
IsFixedLength(PropertyBuilder, bool)
Configures the property as capable of storing only fixed-length data, such as strings.
public static PropertyBuilder IsFixedLength(this PropertyBuilder propertyBuilder, bool fixedLength = true)
Parameters
propertyBuilderPropertyBuilderThe builder for the property being configured.
fixedLengthboolA value indicating whether the property is constrained to fixed length values.
Returns
- PropertyBuilder
The same builder instance so that multiple configuration calls can be chained.
Remarks
See Modeling entity types and relationships for more information and examples.
IsFixedLength<TProperty>(PropertyBuilder<TProperty>, bool)
Configures the property as capable of storing only fixed-length data, such as strings.
public static PropertyBuilder<TProperty> IsFixedLength<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, bool fixedLength = true)
Parameters
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
fixedLengthboolA value indicating whether the property is constrained to fixed length values.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple configuration calls can be chained.
Type Parameters
TPropertyThe type of the property being configured.
Remarks
See Modeling entity types and relationships for more information and examples.
IsStoredComputedColumn(IConventionPropertyBuilder, bool?, bool)
Configures the property to map to a computed column of the given type when targeting a relational database.
public static IConventionPropertyBuilder? IsStoredComputedColumn(this IConventionPropertyBuilder propertyBuilder, bool? stored, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
storedbool?If true, the computed value is calculated on row modification and stored in the database like a regular column. If false, the value is computed when the value is read, and does not occupy any actual storage. null selects the database provider default.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied, null otherwise.
Remarks
See Database default values for more information and examples.
UseCollation(IConventionPropertyBuilder, string?, bool)
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.
public static IConventionPropertyBuilder? UseCollation(this IConventionPropertyBuilder propertyBuilder, string? collation, bool fromDataAnnotation = false)
Parameters
propertyBuilderIConventionPropertyBuilderThe builder for the property being configured.
collationstringThe collation.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionPropertyBuilder
The same builder instance if the configuration was applied, null otherwise.
Remarks
See Database collations for more information and examples.
UseCollation(PropertyBuilder, string?)
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.
public static PropertyBuilder UseCollation(this PropertyBuilder propertyBuilder, string? collation)
Parameters
propertyBuilderPropertyBuilderThe builder for the property being configured.
collationstringThe collation for the column.
Returns
- PropertyBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Database collations for more information and examples.
UseCollation<TProperty>(PropertyBuilder<TProperty>, string?)
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.
public static PropertyBuilder<TProperty> UseCollation<TProperty>(this PropertyBuilder<TProperty> propertyBuilder, string? collation)
Parameters
propertyBuilderPropertyBuilder<TProperty>The builder for the property being configured.
collationstringThe collation for the column.
Returns
- PropertyBuilder<TProperty>
The same builder instance so that multiple calls can be chained.
Type Parameters
TProperty
Remarks
See Database collations for more information and examples.