Table of Contents

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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

collation string

The collation.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the given value can be set as default for the column.

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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

name string

The name of the column.

storeObject StoreObjectIdentifier

The identifier of the store object.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the property can be mapped to the given column.

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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

name string

The name of the column.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the property can be mapped to the given column.

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

propertyBuilder IConventionPropertyBuilder

The builder of the property being configured.

order int?

The column order.

fromDataAnnotation bool

A value indicating whether the configuration was specified using a data annotation.

Returns

bool

true if the column order can be set for the property.

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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

typeName string

The name of the data type of the column.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the given data type can be set for the property.

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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

comment string

The comment for the column.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the given value can be set as default for the column.

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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

sql string

The SQL expression that computes values for the column.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the given computed value SQL expression can be set for the column.

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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

value object

The default value of the column.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the given value can be set as default for the column.

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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

sql string

The SQL expression for the default value of the column.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the given default value expression can be set for the column.

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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

fixedLength bool?

A value indicating whether the property is constrained to fixed length values.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the property can be configured as being fixed length or not.

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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

stored bool?

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.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the given computed column type can be set for the column.

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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

name string

JSON property name to be used.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the given value can be set as JSON property name for this entity property.

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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

name string

The name of the column.

storeObject StoreObjectIdentifier

The identifier of the store object.

fromDataAnnotation bool

Indicates 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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

name string

The name of the column.

fromDataAnnotation bool

Indicates 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

propertyBuilder PropertyBuilder

The builder for the property being configured.

name string

The 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

propertyBuilder PropertyBuilder<TProperty>

The builder for the property being configured.

name string

The name of the column.

Returns

PropertyBuilder<TProperty>

The same builder instance so that multiple calls can be chained.

Type Parameters

TProperty

The 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

propertyBuilder IConventionPropertyBuilder

The builder of the property being configured.

order int?

The column order.

fromDataAnnotation bool

A 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

propertyBuilder PropertyBuilder

The builder of the property being configured.

order int?

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

propertyBuilder PropertyBuilder<TProperty>

The builder of the property being configured.

order int?

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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

typeName string

The name of the data type of the column.

fromDataAnnotation bool

Indicates 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

propertyBuilder PropertyBuilder

The builder for the property being configured.

typeName string

The 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

propertyBuilder PropertyBuilder<TProperty>

The builder for the property being configured.

typeName string

The name of the data type of the column.

Returns

PropertyBuilder<TProperty>

The same builder instance so that multiple calls can be chained.

Type Parameters

TProperty

The 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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

comment string

The comment for the column.

fromDataAnnotation bool

Indicates 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

propertyBuilder PropertyBuilder

The builder for the property being configured.

comment string

The 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

propertyBuilder PropertyBuilder<TProperty>

The builder for the property being configured.

comment string

The comment for the column.

Returns

PropertyBuilder<TProperty>

The same builder instance so that multiple calls can be chained.

Type Parameters

TProperty

The 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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

sql string

The SQL expression that computes values for the column.

fromDataAnnotation bool

Indicates 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

propertyBuilder PropertyBuilder

The 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

propertyBuilder PropertyBuilder

The builder for the property being configured.

sql string

The 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

propertyBuilder PropertyBuilder

The builder for the property being configured.

sql string

The SQL expression that computes values for the column.

stored bool?

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

propertyBuilder PropertyBuilder<TProperty>

The builder for the property being configured.

Returns

PropertyBuilder<TProperty>

The same builder instance so that multiple calls can be chained.

Type Parameters

TProperty

The 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

propertyBuilder PropertyBuilder<TProperty>

The builder for the property being configured.

sql string

The SQL expression that computes values for the column.

Returns

PropertyBuilder<TProperty>

The same builder instance so that multiple calls can be chained.

Type Parameters

TProperty

The 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

propertyBuilder PropertyBuilder<TProperty>

The builder for the property being configured.

sql string

The SQL expression that computes values for the column.

stored bool?

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

TProperty

The 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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

value object

The default value of the column.

fromDataAnnotation bool

Indicates 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

propertyBuilder PropertyBuilder

The 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

propertyBuilder PropertyBuilder

The builder for the property being configured.

value object

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(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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

sql string

The SQL expression for the default value of the column.

fromDataAnnotation bool

Indicates 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

propertyBuilder PropertyBuilder

The 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

propertyBuilder PropertyBuilder

The builder for the property being configured.

sql string

The 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

propertyBuilder PropertyBuilder<TProperty>

The builder for the property being configured.

Returns

PropertyBuilder<TProperty>

The same builder instance so that multiple calls can be chained.

Type Parameters

TProperty

The 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

propertyBuilder PropertyBuilder<TProperty>

The builder for the property being configured.

sql string

The 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

TProperty

The 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

propertyBuilder PropertyBuilder<TProperty>

The builder for the property being configured.

Returns

PropertyBuilder<TProperty>

The same builder instance so that multiple calls can be chained.

Type Parameters

TProperty

The 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

propertyBuilder PropertyBuilder<TProperty>

The builder for the property being configured.

value object

The default value of the column.

Returns

PropertyBuilder<TProperty>

The same builder instance so that multiple calls can be chained.

Type Parameters

TProperty

The 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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

name string

JSON property name to be used.

fromDataAnnotation bool

Indicates 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

propertyBuilder PropertyBuilder

The builder for the property being configured.

name string

JSON 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

propertyBuilder PropertyBuilder<TProperty>

The builder for the property being configured.

name string

JSON 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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

fixedLength bool?

A value indicating whether the property is constrained to fixed length values.

fromDataAnnotation bool

Indicates 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

propertyBuilder PropertyBuilder

The builder for the property being configured.

fixedLength bool

A 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

propertyBuilder PropertyBuilder<TProperty>

The builder for the property being configured.

fixedLength bool

A 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

TProperty

The 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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

stored bool?

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.

fromDataAnnotation bool

Indicates 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

propertyBuilder IConventionPropertyBuilder

The builder for the property being configured.

collation string

The collation.

fromDataAnnotation bool

Indicates 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

propertyBuilder PropertyBuilder

The builder for the property being configured.

collation string

The 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

propertyBuilder PropertyBuilder<TProperty>

The builder for the property being configured.

collation string

The 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.