RelationalValueGenerationConvention 類別

定義

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

public class RelationalValueGenerationConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.ValueGenerationConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyAnnotationChangedConvention
public class RelationalValueGenerationConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.ValueGenerationConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeAnnotationChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyAnnotationChangedConvention
type RelationalValueGenerationConvention = class
    inherit ValueGenerationConvention
    interface IPropertyAnnotationChangedConvention
    interface IConvention
type RelationalValueGenerationConvention = class
    inherit ValueGenerationConvention
    interface IPropertyAnnotationChangedConvention
    interface IConvention
    interface IEntityTypeAnnotationChangedConvention
Public Class RelationalValueGenerationConvention
Inherits ValueGenerationConvention
Implements IPropertyAnnotationChangedConvention
Public Class RelationalValueGenerationConvention
Inherits ValueGenerationConvention
Implements IEntityTypeAnnotationChangedConvention, IPropertyAnnotationChangedConvention
繼承
RelationalValueGenerationConvention
衍生
實作

備註

如需詳細資訊和範例,請參閱 模型建置慣例EF Core 價值產生

建構函式

RelationalValueGenerationConvention(ProviderConventionSetBuilderDependencies, RelationalConventionSetBuilderDependencies)

建立 RelationalValueGenerationConvention 的新執行個體。

屬性

Dependencies

此服務的相依性。

(繼承來源 ValueGenerationConvention)
RelationalDependencies

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

方法

GetValueGenerated(IConventionProperty)

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

GetValueGenerated(IProperty)

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

GetValueGenerated(IProperty, StoreObjectIdentifier)

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

GetValueGenerated(IReadOnlyProperty, StoreObjectIdentifier)

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

MappingStrategyAllowsValueGeneration(IConventionProperty, String)

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

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

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

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>)

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

適用於