Share via


RelationalComplexTypePropertyBuilderExtensions.HasDefaultValue Method

Definition

Overloads

HasDefaultValue(ComplexTypePropertyBuilder)

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

HasDefaultValue(ComplexTypePropertyBuilder, Object)

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

HasDefaultValue<TProperty>(ComplexTypePropertyBuilder<TProperty>)

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

HasDefaultValue<TProperty>(ComplexTypePropertyBuilder<TProperty>, Object)

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

HasDefaultValue(ComplexTypePropertyBuilder)

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

public static Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder HasDefaultValue (this Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder propertyBuilder);
static member HasDefaultValue : Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder -> Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder
<Extension()>
Public Function HasDefaultValue (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

HasDefaultValue(ComplexTypePropertyBuilder, Object)

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

public static Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder HasDefaultValue (this Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder propertyBuilder, object? value);
static member HasDefaultValue : Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder * obj -> Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder
<Extension()>
Public Function HasDefaultValue (propertyBuilder As ComplexTypePropertyBuilder, value As Object) As ComplexTypePropertyBuilder

Parameters

propertyBuilder
ComplexTypePropertyBuilder

The builder for the property being configured.

value
Object

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

HasDefaultValue<TProperty>(ComplexTypePropertyBuilder<TProperty>)

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

public static Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<TProperty> HasDefaultValue<TProperty> (this Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<TProperty> propertyBuilder);
static member HasDefaultValue : Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<'Property> -> Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<'Property>
<Extension()>
Public Function HasDefaultValue(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

HasDefaultValue<TProperty>(ComplexTypePropertyBuilder<TProperty>, Object)

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

public static Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<TProperty> HasDefaultValue<TProperty> (this Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<TProperty> propertyBuilder, object? value);
static member HasDefaultValue : Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<'Property> * obj -> Microsoft.EntityFrameworkCore.Metadata.Builders.ComplexTypePropertyBuilder<'Property>
<Extension()>
Public Function HasDefaultValue(Of TProperty) (propertyBuilder As ComplexTypePropertyBuilder(Of TProperty), value As Object) 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.

value
Object

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