語言

StoreKeyConvention 類別

定義

一個加入「id」屬性的慣例——這是 Azure Cosmos 所要求的金鑰。

public class StoreKeyConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeAnnotationChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeBaseTypeChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyOwnershipChangedConvention
public class StoreKeyConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeAnnotationChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeBaseTypeChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyOwnershipChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyRemovedConvention
public class StoreKeyConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeAnnotationChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeBaseTypeChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypePrimaryKeyChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyOwnershipChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyAnnotationChangedConvention
[System.Runtime.CompilerServices.Nullable(0)]
public class StoreKeyConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeAnnotationChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeBaseTypeChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypePrimaryKeyChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyOwnershipChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyAnnotationChangedConvention
type StoreKeyConvention = class
    interface IEntityTypeAddedConvention
    interface IConvention
    interface IForeignKeyOwnershipChangedConvention
    interface IEntityTypeAnnotationChangedConvention
    interface IEntityTypeBaseTypeChangedConvention
type StoreKeyConvention = class
    interface IEntityTypeAddedConvention
    interface IConvention
    interface IForeignKeyOwnershipChangedConvention
    interface IForeignKeyRemovedConvention
    interface IEntityTypeAnnotationChangedConvention
    interface IEntityTypeBaseTypeChangedConvention
type StoreKeyConvention = class
    interface IEntityTypeAddedConvention
    interface IConvention
    interface IPropertyAnnotationChangedConvention
    interface IForeignKeyOwnershipChangedConvention
    interface IForeignKeyRemovedConvention
    interface IKeyAddedConvention
    interface IKeyRemovedConvention
    interface IEntityTypePrimaryKeyChangedConvention
    interface IEntityTypeAnnotationChangedConvention
    interface IEntityTypeBaseTypeChangedConvention
[<System.Runtime.CompilerServices.Nullable(0)>]
type StoreKeyConvention = class
    interface IEntityTypeAddedConvention
    interface IConvention
    interface IPropertyAnnotationChangedConvention
    interface IForeignKeyOwnershipChangedConvention
    interface IForeignKeyRemovedConvention
    interface IKeyAddedConvention
    interface IKeyRemovedConvention
    interface IEntityTypePrimaryKeyChangedConvention
    interface IEntityTypeAnnotationChangedConvention
    interface IEntityTypeBaseTypeChangedConvention
Public Class StoreKeyConvention
Implements IEntityTypeAddedConvention, IEntityTypeAnnotationChangedConvention, IEntityTypeBaseTypeChangedConvention, IForeignKeyOwnershipChangedConvention
Public Class StoreKeyConvention
Implements IEntityTypeAddedConvention, IEntityTypeAnnotationChangedConvention, IEntityTypeBaseTypeChangedConvention, IForeignKeyOwnershipChangedConvention, IForeignKeyRemovedConvention
Public Class StoreKeyConvention
Implements IEntityTypeAddedConvention, IEntityTypeAnnotationChangedConvention, IEntityTypeBaseTypeChangedConvention, IEntityTypePrimaryKeyChangedConvention, IForeignKeyOwnershipChangedConvention, IForeignKeyRemovedConvention, IKeyAddedConvention, IKeyRemovedConvention, IPropertyAnnotationChangedConvention
繼承
StoreKeyConvention
屬性
實作

備註

此慣例還會加入包含 JSON 物件的「__jObject」。

更多資訊與範例請參閱模型建構慣例,以及使用 EF Core 存取 Azure Cosmos DB。

建構函式

名稱 Description
StoreKeyConvention(ProviderConventionSetBuilderDependencies)

建立一個新的 實例。StoreKeyConvention

欄位

名稱 Description
DefaultIdPropertyName

這是一個內部 API,支援 Entity Framework Core 基礎架構,且不受公開 API 相同的相容性標準約束。 該內容可能會在任何新聞稿中未經通知而更改或移除。 你應該只在程式碼中直接使用它,並且要非常謹慎,並且要知道這樣做可能會導致更新到新的 Entity Framework Core 版本時應用程式失敗。

IdPropertyJsonName

這是一個內部 API,支援 Entity Framework Core 基礎架構,且不受公開 API 相同的相容性標準約束。 該內容可能會在任何新聞稿中未經通知而更改或移除。 你應該只在程式碼中直接使用它,並且要非常謹慎,並且要知道這樣做可能會導致更新到新的 Entity Framework Core 版本時應用程式失敗。

IdPropertyName

一個加入「id」屬性的慣例——這是 Azure Cosmos 所要求的金鑰。

JObjectPropertyName

這是一個內部 API,支援 Entity Framework Core 基礎架構,且不受公開 API 相同的相容性標準約束。 該內容可能會在任何新聞稿中未經通知而更改或移除。 你應該只在程式碼中直接使用它,並且要非常謹慎,並且要知道這樣做可能會導致更新到新的 Entity Framework Core 版本時應用程式失敗。

屬性

名稱 Description
Dependencies

此服務的依賴關係。

方法

名稱 Description
ProcessEntityTypeAdded(IConventionEntityTypeBuilder, IConventionContext<IConventionEntityTypeBuilder>)

在模型中加入實體類型後呼叫。

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

在某個實體類型更改註解後呼叫。

ProcessEntityTypeBaseTypeChanged(IConventionEntityTypeBuilder, IConventionEntityType, IConventionEntityType, IConventionContext<IConventionEntityType>)

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

ProcessEntityTypePrimaryKeyChanged(IConventionEntityTypeBuilder, IConventionKey, IConventionKey, IConventionContext<IConventionKey>)

在實體類型的主金鑰被更改後呼叫。

ProcessForeignKeyOwnershipChanged(IConventionForeignKeyBuilder, IConventionContext<Nullable<Boolean>>)

在外金鑰的所有權值改變後才被呼叫。

ProcessForeignKeyOwnershipChanged(IConventionRelationshipBuilder, IConventionContext<IConventionRelationshipBuilder>)

在外金鑰的所有權值改變後才被呼叫。

ProcessForeignKeyRemoved(IConventionEntityTypeBuilder, IConventionForeignKey, IConventionContext<IConventionForeignKey>)

在移除外金鑰後呼叫。

ProcessKeyAdded(IConventionKeyBuilder, IConventionContext<IConventionKeyBuilder>)

在實體類型中加入鍵數後呼叫。

ProcessKeyRemoved(IConventionEntityTypeBuilder, IConventionKey, IConventionContext<IConventionKey>)

鑰匙被取走後才呼叫。

ProcessPropertyAnnotationChanged(IConventionPropertyBuilder, String, IConventionAnnotation, IConventionAnnotation, IConventionContext<IConventionAnnotation>)

在屬性的註解被更改後呼叫。

適用於