SqlServerPropertyBuilderExtensions.HasValueGenerationStrategy 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
HasValueGenerationStrategy(IConventionPropertyBuilder, Nullable<SqlServerValueGenerationStrategy>, Boolean)
针对SQL Server时,为键属性配置值生成策略。
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder HasValueGenerationStrategy (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder propertyBuilder, Microsoft.EntityFrameworkCore.Metadata.SqlServerValueGenerationStrategy? valueGenerationStrategy, bool fromDataAnnotation = false);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder? HasValueGenerationStrategy (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder propertyBuilder, Microsoft.EntityFrameworkCore.Metadata.SqlServerValueGenerationStrategy? valueGenerationStrategy, bool fromDataAnnotation = false);
static member HasValueGenerationStrategy : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder * Nullable<Microsoft.EntityFrameworkCore.Metadata.SqlServerValueGenerationStrategy> * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder
<Extension()>
Public Function HasValueGenerationStrategy (propertyBuilder As IConventionPropertyBuilder, valueGenerationStrategy As Nullable(Of SqlServerValueGenerationStrategy), Optional fromDataAnnotation As Boolean = false) As IConventionPropertyBuilder
参数
- propertyBuilder
- IConventionPropertyBuilder
要配置的属性的生成器。
- valueGenerationStrategy
- Nullable<SqlServerValueGenerationStrategy>
值生成策略。
- fromDataAnnotation
- Boolean
指示是否使用数据注释指定配置。
返回
如果应用了配置,则为同一生成器实例, null
否则为 。
注解
有关详细信息和示例,请参阅为实体类型和关系建模和使用 EF Core 访问SQL Server和Azure SQL数据库。
适用于
HasValueGenerationStrategy(IConventionPropertyBuilder, Nullable<SqlServerValueGenerationStrategy>, StoreObjectIdentifier, Boolean)
针对特定表的SQL Server时,为键属性配置值生成策略。
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder? HasValueGenerationStrategy (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder propertyBuilder, Microsoft.EntityFrameworkCore.Metadata.SqlServerValueGenerationStrategy? valueGenerationStrategy, in Microsoft.EntityFrameworkCore.Metadata.StoreObjectIdentifier storeObject, bool fromDataAnnotation = false);
static member HasValueGenerationStrategy : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder * Nullable<Microsoft.EntityFrameworkCore.Metadata.SqlServerValueGenerationStrategy> * StoreObjectIdentifier * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionPropertyBuilder
<Extension()>
Public Function HasValueGenerationStrategy (propertyBuilder As IConventionPropertyBuilder, valueGenerationStrategy As Nullable(Of SqlServerValueGenerationStrategy), ByRef storeObject As StoreObjectIdentifier, Optional fromDataAnnotation As Boolean = false) As IConventionPropertyBuilder
参数
- propertyBuilder
- IConventionPropertyBuilder
要配置的属性的生成器。
- valueGenerationStrategy
- Nullable<SqlServerValueGenerationStrategy>
值生成策略。
- storeObject
- StoreObjectIdentifier
表标识符。
- fromDataAnnotation
- Boolean
指示是否使用数据注释指定配置。
返回
如果应用了配置,则为同一生成器实例, null
否则为 。
注解
有关详细信息和示例,请参阅为实体类型和关系建模和使用 EF Core 访问SQL Server和Azure SQL数据库。