Share via


RelationalComplexTypePropertyBuilderExtensions.HasDefaultValueSql Method

Definition

Overloads

HasDefaultValueSql(ComplexTypePropertyBuilder)

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

HasDefaultValueSql(ComplexTypePropertyBuilder, String)

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

HasDefaultValueSql<TProperty>(ComplexTypePropertyBuilder<TProperty>)

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

HasDefaultValueSql<TProperty>(ComplexTypePropertyBuilder<TProperty>, String)

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

HasDefaultValueSql(ComplexTypePropertyBuilder)

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

public static Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder HasDefaultValueSql (this Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder propertyBuilder);
static member HasDefaultValueSql : Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder -> Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder
<Extension()>
Public Function HasDefaultValueSql (propertyBuilder As ComplexTypePropertyBuilder) As ComplexTypePropertyBuilder

Parameters

propertyBuilder
ComplexTypePropertyBuilder

The builder for the property being configured.

Returns

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.

Applies to

HasDefaultValueSql(ComplexTypePropertyBuilder, String)

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

public static Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder HasDefaultValueSql (this Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder propertyBuilder, string? sql);
static member HasDefaultValueSql : Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder
<Extension()>
Public Function HasDefaultValueSql (propertyBuilder As ComplexTypePropertyBuilder, sql As String) As ComplexTypePropertyBuilder

Parameters

propertyBuilder
ComplexTypePropertyBuilder

The builder for the property being configured.

sql
String

The SQL expression for the default value of the column.

Returns

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

Remarks

See Database default values for more information and examples.

Applies to

HasDefaultValueSql<TProperty>(ComplexTypePropertyBuilder<TProperty>)

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

public static Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<TProperty> HasDefaultValueSql<TProperty> (this Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<TProperty> propertyBuilder);
static member HasDefaultValueSql : Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<'Property> -> Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<'Property>
<Extension()>
Public Function HasDefaultValueSql(Of TProperty) (propertyBuilder As ComplexTypePropertyBuilder(Of TProperty)) As ComplexTypePropertyBuilder(Of TProperty)

Type Parameters

TProperty

The type of the property being configured.

Parameters

propertyBuilder
ComplexTypePropertyBuilder<TProperty>

The builder for the property being configured.

Returns

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.

Applies to

HasDefaultValueSql<TProperty>(ComplexTypePropertyBuilder<TProperty>, String)

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

public static Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<TProperty> HasDefaultValueSql<TProperty> (this Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<TProperty> propertyBuilder, string? sql);
static member HasDefaultValueSql : Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<'Property> * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<'Property>
<Extension()>
Public Function HasDefaultValueSql(Of TProperty) (propertyBuilder As ComplexTypePropertyBuilder(Of TProperty), sql As String) As ComplexTypePropertyBuilder(Of TProperty)

Type Parameters

TProperty

The type of the property being configured.

Parameters

propertyBuilder
ComplexTypePropertyBuilder<TProperty>

The builder for the property being configured.

sql
String

The SQL expression for the default value of the column.

Returns

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

Remarks

See Database default values for more information and examples.

Applies to