语言

CosmosJsonIdConvention 类

定义

一种约定,用于配置将 PK 和/或歧视性属性映射到 JSON“id”属性。

[System.Runtime.CompilerServices.Nullable(0)]
public class CosmosJsonIdConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.IDiscriminatorPropertySetConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeAnnotationChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeBaseTypeChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyOwnershipChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IModelAnnotationChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyAnnotationChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyRemovedConvention
[<System.Runtime.CompilerServices.Nullable(0)>]
type CosmosJsonIdConvention = class
    interface IEntityTypeAddedConvention
    interface IConvention
    interface IEntityTypeBaseTypeChangedConvention
    interface IEntityTypeAnnotationChangedConvention
    interface IForeignKeyOwnershipChangedConvention
    interface IKeyAddedConvention
    interface IKeyRemovedConvention
    interface IPropertyAddedConvention
    interface IPropertyRemovedConvention
    interface IPropertyAnnotationChangedConvention
    interface IModelAnnotationChangedConvention
    interface IDiscriminatorPropertySetConvention
Public Class CosmosJsonIdConvention
Implements IDiscriminatorPropertySetConvention, IEntityTypeAddedConvention, IEntityTypeAnnotationChangedConvention, IEntityTypeBaseTypeChangedConvention, IForeignKeyOwnershipChangedConvention, IKeyAddedConvention, IKeyRemovedConvention, IModelAnnotationChangedConvention, IPropertyAddedConvention, IPropertyAnnotationChangedConvention, IPropertyRemovedConvention
继承
CosmosJsonIdConvention
特性
实现

注解

有关详细信息和示例,请参阅使用 EF Core的模型生成约定和访问Azure Cosmos DB。

构造函数

名称 说明
CosmosJsonIdConvention(ProviderConventionSetBuilderDependencies, IJsonIdDefinitionFactory)

创建 CosmosJsonIdConvention的新实例。

字段

名称 说明
DefaultIdPropertyName

这是一个内部 API,支持Entity Framework Core基础结构,不受与公共 API 相同的兼容性标准的约束。 可以在任何版本中更改或删除它,而不通知。 只需在代码中直接使用它,并非常谨慎地知道这样做可能会导致应用程序在更新到新的Entity Framework Core版本时失败。

IdPropertyJsonName

这是一个内部 API,支持Entity Framework Core基础结构,不受与公共 API 相同的兼容性标准的约束。 可以在任何版本中更改或删除它,而不通知。 只需在代码中直接使用它,并非常谨慎地知道这样做可能会导致应用程序在更新到新的Entity Framework Core版本时失败。

属性

名称 说明
DefinitionFactory

要为每个实体类型创建一个 Microsoft.EntityFrameworkCore.Cosmos.Metadata.Internal.IJsonIdDefinition 的工厂。

Dependencies

此服务的依赖项。

方法

名称 说明
ProcessDiscriminatorPropertySet(IConventionEntityTypeBuilder, String, IConventionContext<String>)

在设置鉴别器属性后调用。

ProcessDiscriminatorPropertySet(IConventionTypeBaseBuilder, String, IConventionContext<String>)

在设置鉴别器属性后调用。

ProcessEntityTypeAdded(IConventionEntityTypeBuilder, IConventionContext<IConventionEntityTypeBuilder>)

在实体类型添加到模型后调用。

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

在实体类型上更改批注后调用。

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

在实体类型的基类型更改后调用。

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

在外键的所有权值更改后调用。

ProcessKeyAdded(IConventionKeyBuilder, IConventionContext<IConventionKeyBuilder>)

在将键添加到实体类型后调用。

ProcessKeyRemoved(IConventionEntityTypeBuilder, IConventionKey, IConventionContext<IConventionKey>)

删除密钥后调用。

ProcessModelAnnotationChanged(IConventionModelBuilder, String, IConventionAnnotation, IConventionAnnotation, IConventionContext<IConventionAnnotation>)

在模型上更改批注后调用。

ProcessPropertyAdded(IConventionPropertyBuilder, IConventionContext<IConventionPropertyBuilder>)

在将属性添加到实体类型后调用。

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

在属性上更改批注后调用。

ProcessPropertyRemoved(IConventionTypeBaseBuilder, IConventionProperty, IConventionContext<IConventionProperty>)

从实体类型中删除属性后调用。

适用于