共用方式為


SqlServerPropertyBuilderExtensions.HasValueGenerationStrategy 方法

定義

多載

HasValueGenerationStrategy(IConventionPropertyBuilder, Nullable<SqlServerValueGenerationStrategy>, Boolean)

以SQL Server為目標時,設定索引鍵屬性的值產生策略。

HasValueGenerationStrategy(IConventionPropertyBuilder, Nullable<SqlServerValueGenerationStrategy>, StoreObjectIdentifier, Boolean)

針對特定資料表的目標SQL Server時,設定索引鍵屬性的值產生策略。

HasValueGenerationStrategy(IConventionPropertyBuilder, Nullable<SqlServerValueGenerationStrategy>, Boolean)

來源:
SqlServerPropertyBuilderExtensions.cs
來源:
SqlServerPropertyBuilderExtensions.cs
來源:
SqlServerPropertyBuilderExtensions.cs
來源:
SqlServerPropertyBuilderExtensions.cs
來源:
SqlServerPropertyBuilderExtensions.cs
來源:
SqlServerPropertyBuilderExtensions.cs
來源:
SqlServerPropertyBuilderExtensions.cs

以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建立實體類型和關聯性的模型化,以及使用 EF Core 存取SQL Server和Azure SQL資料庫

適用於

HasValueGenerationStrategy(IConventionPropertyBuilder, Nullable<SqlServerValueGenerationStrategy>, StoreObjectIdentifier, Boolean)

來源:
SqlServerPropertyBuilderExtensions.cs
來源:
SqlServerPropertyBuilderExtensions.cs
來源:
SqlServerPropertyBuilderExtensions.cs

針對特定資料表的目標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建立實體類型和關聯性的模型化,以及使用 EF Core 存取SQL Server和Azure SQL資料庫

適用於