RelationalComplexTypePropertyBuilderExtensions.HasDefaultValueSql 方法

定义

重载

HasDefaultValueSql(ComplexTypePropertyBuilder)

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

HasDefaultValueSql(ComplexTypePropertyBuilder, String)

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

HasDefaultValueSql<TProperty>(ComplexTypePropertyBuilder<TProperty>)

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

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

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

HasDefaultValueSql(ComplexTypePropertyBuilder)

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

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

参数

propertyBuilder
ComplexTypePropertyBuilder

要配置的属性的生成器。

返回

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

注解

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

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

适用于

HasDefaultValueSql(ComplexTypePropertyBuilder, String)

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

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

参数

propertyBuilder
ComplexTypePropertyBuilder

要配置的属性的生成器。

sql
String

列的默认值的 SQL 表达式。

返回

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

注解

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

适用于

HasDefaultValueSql<TProperty>(ComplexTypePropertyBuilder<TProperty>)

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

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)

类型参数

TProperty

要配置的属性的类型。

参数

propertyBuilder
ComplexTypePropertyBuilder<TProperty>

要配置的属性的生成器。

返回

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

注解

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

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

适用于

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

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

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)

类型参数

TProperty

要配置的属性的类型。

参数

propertyBuilder
ComplexTypePropertyBuilder<TProperty>

要配置的属性的生成器。

sql
String

列的默认值的 SQL 表达式。

返回

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

注解

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

适用于