Share via


RelationalPrimitiveCollectionBuilderExtensions.HasDefaultValue Method

Definition

Overloads

HasDefaultValue(PrimitiveCollectionBuilder)

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

HasDefaultValue(PrimitiveCollectionBuilder, Object)

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

HasDefaultValue<TProperty>(PrimitiveCollectionBuilder<TProperty>)

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

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

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

HasDefaultValue(PrimitiveCollectionBuilder)

Source:
RelationalPrimitiveCollectionBuilderExtensions.cs
Source:
RelationalPrimitiveCollectionBuilderExtensions.cs

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

public static Microsoft.EntityFrameworkCore.Metadata.Builders.PrimitiveCollectionBuilder HasDefaultValue (this Microsoft.EntityFrameworkCore.Metadata.Builders.PrimitiveCollectionBuilder primitiveCollectionBuilder);
static member HasDefaultValue : Microsoft.EntityFrameworkCore.Metadata.Builders.PrimitiveCollectionBuilder -> Microsoft.EntityFrameworkCore.Metadata.Builders.PrimitiveCollectionBuilder
<Extension()>
Public Function HasDefaultValue (primitiveCollectionBuilder As PrimitiveCollectionBuilder) As PrimitiveCollectionBuilder

Parameters

primitiveCollectionBuilder
PrimitiveCollectionBuilder

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(PrimitiveCollectionBuilder, Object)

Source:
RelationalPrimitiveCollectionBuilderExtensions.cs
Source:
RelationalPrimitiveCollectionBuilderExtensions.cs

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

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

Parameters

primitiveCollectionBuilder
PrimitiveCollectionBuilder

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>(PrimitiveCollectionBuilder<TProperty>)

Source:
RelationalPrimitiveCollectionBuilderExtensions.cs
Source:
RelationalPrimitiveCollectionBuilderExtensions.cs

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

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

Type Parameters

TProperty

The type of the property being configured.

Parameters

primitiveCollectionBuilder
PrimitiveCollectionBuilder<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>(PrimitiveCollectionBuilder<TProperty>, Object)

Source:
RelationalPrimitiveCollectionBuilderExtensions.cs
Source:
RelationalPrimitiveCollectionBuilderExtensions.cs

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

public static Microsoft.EntityFrameworkCore.Metadata.Builders.PrimitiveCollectionBuilder<TProperty> HasDefaultValue<TProperty> (this Microsoft.EntityFrameworkCore.Metadata.Builders.PrimitiveCollectionBuilder<TProperty> primitiveCollectionBuilder, object? value);
static member HasDefaultValue : Microsoft.EntityFrameworkCore.Metadata.Builders.PrimitiveCollectionBuilder<'Property> * obj -> Microsoft.EntityFrameworkCore.Metadata.Builders.PrimitiveCollectionBuilder<'Property>
<Extension()>
Public Function HasDefaultValue(Of TProperty) (primitiveCollectionBuilder As PrimitiveCollectionBuilder(Of TProperty), value As Object) As PrimitiveCollectionBuilder(Of TProperty)

Type Parameters

TProperty

The type of the property being configured.

Parameters

primitiveCollectionBuilder
PrimitiveCollectionBuilder<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