SqlServerValueGenerationConvention 類別

定義

將儲存值產生設定為 OnAdd 主鍵一部分而非任何外鍵一部分之屬性的慣例,其設定為具有資料庫預設值,或設定為使用 SqlServerValueGenerationStrategy 。 它也會設定屬性,就像是設定為計算資料行一樣 OnAddOrUpdate

public class SqlServerValueGenerationConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.RelationalValueGenerationConvention
type SqlServerValueGenerationConvention = class
    inherit RelationalValueGenerationConvention
Public Class SqlServerValueGenerationConvention
Inherits RelationalValueGenerationConvention
繼承

備註

如需詳細資訊和範例,請參閱使用 EF Core建立模型慣例和存取SQL Server和Azure SQL資料庫

建構函式

SqlServerValueGenerationConvention(ProviderConventionSetBuilderDependencies, RelationalConventionSetBuilderDependencies)

建立 SqlServerValueGenerationConvention 的新執行個體。

屬性

Dependencies

此服務的相依性。

(繼承來源 ValueGenerationConvention)
RelationalDependencies

此服務的關聯式提供者特定相依性。

(繼承來源 RelationalValueGenerationConvention)

方法

GetValueGenerated(IConventionProperty)

傳回為指定屬性設定的存放區值產生策略。

GetValueGenerated(IProperty)

傳回為指定屬性設定的存放區值產生策略。

GetValueGenerated(IProperty, StoreObjectIdentifier)

傳回為指定屬性設定的存放區值產生策略。

GetValueGenerated(IReadOnlyProperty, StoreObjectIdentifier)

傳回為指定屬性設定的存放區值產生策略。

MappingStrategyAllowsValueGeneration(IConventionProperty, String)

檢查對應策略和屬性是否允許依慣例產生值。

(繼承來源 RelationalValueGenerationConvention)
ProcessEntityTypeAnnotationChanged(IConventionEntityTypeBuilder, String, IConventionAnnotation, IConventionAnnotation, IConventionContext<IConventionAnnotation>)

在實體上變更批註之後呼叫。

ProcessEntityTypeAnnotationChanged(IConventionEntityTypeBuilder, String, IConventionAnnotation, IConventionAnnotation, IConventionContext<IConventionAnnotation>)

在實體類型上變更批註之後呼叫。

(繼承來源 RelationalValueGenerationConvention)
ProcessEntityTypeBaseTypeChanged(IConventionEntityTypeBuilder, IConventionEntityType, IConventionEntityType, IConventionContext<IConventionEntityType>)

在實體類型的基底類型變更之後呼叫。

(繼承來源 ValueGenerationConvention)
ProcessEntityTypePrimaryKeyChanged(IConventionEntityTypeBuilder, IConventionKey, IConventionKey, IConventionContext<IConventionKey>)

變更實體類型的主鍵之後呼叫。

(繼承來源 ValueGenerationConvention)
ProcessForeignKeyAdded(IConventionForeignKeyBuilder, IConventionContext<IConventionForeignKeyBuilder>)

在將外鍵新增至實體類型之後呼叫。

(繼承來源 ValueGenerationConvention)
ProcessForeignKeyAdded(IConventionRelationshipBuilder, IConventionContext<IConventionRelationshipBuilder>)

在將外鍵新增至實體類型之後呼叫。

(繼承來源 ValueGenerationConvention)
ProcessForeignKeyOwnershipChanged(IConventionForeignKeyBuilder, IConventionContext<Nullable<Boolean>>)

在外鍵的擁有權值變更之後呼叫。

(繼承來源 ValueGenerationConvention)
ProcessForeignKeyPropertiesChanged(IConventionForeignKeyBuilder, IReadOnlyList<IConventionProperty>, IConventionKey, IConventionContext<IReadOnlyList<IConventionProperty>>)

在外鍵屬性或主體索引鍵變更之後呼叫。

(繼承來源 ValueGenerationConvention)
ProcessForeignKeyPropertiesChanged(IConventionRelationshipBuilder, IReadOnlyList<IConventionProperty>, IConventionKey, IConventionContext<IConventionRelationshipBuilder>)

在外鍵屬性或主體索引鍵變更之後呼叫。

(繼承來源 ValueGenerationConvention)
ProcessForeignKeyRemoved(IConventionEntityTypeBuilder, IConventionForeignKey, IConventionContext<IConventionForeignKey>)

移除外鍵之後呼叫。

(繼承來源 ValueGenerationConvention)
ProcessPropertyAnnotationChanged(IConventionPropertyBuilder, String, IConventionAnnotation, IConventionAnnotation, IConventionContext<IConventionAnnotation>)

在屬性上變更批註之後呼叫。

適用於