语言

SqlServerPropertyBuilderExtensions.HasDefaultValueSql 方法

定义

重载

名称 说明
HasDefaultValueSql(PropertyBuilder, String, String)

配置属性在定位SQL Server时映射到的列的默认值表达式。

HasDefaultValueSql(IConventionPropertyBuilder, String, String, Boolean)

配置属性在定位SQL Server时映射到的列的默认值表达式。

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

配置属性在定位SQL Server时映射到的列的默认值表达式。

HasDefaultValueSql(PropertyBuilder, String, String)

Source:
SqlServerPropertyBuilderExtensions.cs
Source:
SqlServerPropertyBuilderExtensions.cs

配置属性在定位SQL Server时映射到的列的默认值表达式。

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

参数

propertyBuilder
PropertyBuilder

要配置的属性的生成器。

sql
String

列的默认值的 SQL 表达式。

defaultConstraintName
String

默认约束名称。

返回

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

注解

有关详细信息和示例,请参阅建模实体类型和关系,以及使用 EF Core 访问SQL Server和Azure SQL数据库。

适用于

HasDefaultValueSql(IConventionPropertyBuilder, String, String, Boolean)

Source:
SqlServerPropertyBuilderExtensions.cs
Source:
SqlServerPropertyBuilderExtensions.cs

配置属性在定位SQL Server时映射到的列的默认值表达式。

public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder? HasDefaultValueSql(this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder propertyBuilder, string? sql, string defaultConstraintName, bool fromDataAnnotation = false);
static member HasDefaultValueSql : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder * string * string * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder
<Extension()>
Public Function HasDefaultValueSql (propertyBuilder As IConventionPropertyBuilder, sql As String, defaultConstraintName As String, Optional fromDataAnnotation As Boolean = false) As IConventionPropertyBuilder

参数

propertyBuilder
IConventionPropertyBuilder

要配置的属性的生成器。

sql
String

列的默认值的 SQL 表达式。

defaultConstraintName
String

默认约束名称。

fromDataAnnotation
Boolean

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

返回

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

注解

有关详细信息和示例,请参阅建模实体类型和关系,以及使用 EF Core 访问SQL Server和Azure SQL数据库。

适用于

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

Source:
SqlServerPropertyBuilderExtensions.cs
Source:
SqlServerPropertyBuilderExtensions.cs

配置属性在定位SQL Server时映射到的列的默认值表达式。

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

类型参数

TProperty

要配置的属性的类型。

参数

propertyBuilder
PropertyBuilder<TProperty>

要配置的属性的生成器。

sql
String

列的默认值的 SQL 表达式。

defaultConstraintName
String

默认约束名称。

返回

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

注解

有关详细信息和示例,请参阅建模实体类型和关系,以及使用 EF Core 访问SQL Server和Azure SQL数据库。

适用于