RelationalPropertyBuilderExtensions.HasDefaultValue 方法

定义

重载

HasDefaultValue(PropertyBuilder)

配置属性在面向关系数据库时映射到的列的默认值。

HasDefaultValue(PropertyBuilder, Object)

配置属性在面向关系数据库时映射到的列的默认值。

HasDefaultValue(IConventionPropertyBuilder, Object, Boolean)

配置属性在面向关系数据库时映射到的列的默认值。

HasDefaultValue<TProperty>(PropertyBuilder<TProperty>)

配置属性在面向关系数据库时映射到的列的默认值。

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

配置属性在面向关系数据库时映射到的列的默认值。

HasDefaultValue(PropertyBuilder)

Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs

配置属性在面向关系数据库时映射到的列的默认值。

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

参数

propertyBuilder
PropertyBuilder

要配置的属性的生成器。

返回

同一生成器实例,以便可以链接多个调用。

注解

在没有参数的情况下调用时,此方法会告知 EF 列具有某种类型的默认值约束,而无需确切指定它是什么。 将 EF 映射到现有数据库时,这非常有用。

有关详细信息和示例,请参阅 数据库默认值

适用于

HasDefaultValue(PropertyBuilder, Object)

Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs

配置属性在面向关系数据库时映射到的列的默认值。

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

参数

propertyBuilder
PropertyBuilder

要配置的属性的生成器。

value
Object

列的默认值。

返回

同一生成器实例,以便可以链接多个调用。

注解

有关详细信息和示例,请参阅 数据库默认值

适用于

HasDefaultValue(IConventionPropertyBuilder, Object, Boolean)

Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs

配置属性在面向关系数据库时映射到的列的默认值。

public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder HasDefaultValue (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder propertyBuilder, object value, bool fromDataAnnotation = false);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder? HasDefaultValue (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder propertyBuilder, object? value, bool fromDataAnnotation = false);
static member HasDefaultValue : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder * obj * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder
<Extension()>
Public Function HasDefaultValue (propertyBuilder As IConventionPropertyBuilder, value As Object, Optional fromDataAnnotation As Boolean = false) As IConventionPropertyBuilder

参数

propertyBuilder
IConventionPropertyBuilder

要配置的属性的生成器。

value
Object

列的默认值。

fromDataAnnotation
Boolean

指示是否使用数据注释指定配置。

返回

如果应用了配置,则为同一生成器实例, null 否则为 。

注解

有关详细信息和示例,请参阅 数据库默认值

适用于

HasDefaultValue<TProperty>(PropertyBuilder<TProperty>)

Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs

配置属性在面向关系数据库时映射到的列的默认值。

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

类型参数

TProperty

要配置的属性的类型。

参数

propertyBuilder
PropertyBuilder<TProperty>

要配置的属性的生成器。

返回

同一生成器实例,以便可以链接多个调用。

注解

在没有参数的情况下调用时,此方法会告知 EF 列具有某种类型的默认值约束,而无需确切指定它是什么。 将 EF 映射到现有数据库时,这非常有用。

有关详细信息和示例,请参阅 数据库默认值

适用于

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

Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs
Source:
RelationalPropertyBuilderExtensions.cs

配置属性在面向关系数据库时映射到的列的默认值。

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

类型参数

TProperty

要配置的属性的类型。

参数

propertyBuilder
PropertyBuilder<TProperty>

要配置的属性的生成器。

value
Object

列的默认值。

返回

同一生成器实例,以便可以链接多个调用。

注解

有关详细信息和示例,请参阅 数据库默认值

适用于