共用方式為


CosmosKeyDiscoveryConvention Class

Definition

A convention that finds primary key property for the entity type based on the names and adds the partition key to it if present.

public class CosmosKeyDiscoveryConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.KeyDiscoveryConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeAnnotationChangedConvention
type CosmosKeyDiscoveryConvention = class
    inherit KeyDiscoveryConvention
    interface IEntityTypeAnnotationChangedConvention
    interface IConvention
Public Class CosmosKeyDiscoveryConvention
Inherits KeyDiscoveryConvention
Implements IEntityTypeAnnotationChangedConvention
Inheritance
CosmosKeyDiscoveryConvention
Implements

Remarks

See Model building conventions, and Accessing Azure Cosmos DB with EF Core for more information and examples.

Constructors

CosmosKeyDiscoveryConvention(ProviderConventionSetBuilderDependencies)

Creates a new instance of CosmosKeyDiscoveryConvention.

Properties

Dependencies

Dependencies for this service.

(Inherited from KeyDiscoveryConvention)

Methods

DiscoverKeyProperties(IConventionEntityType)

Returns the properties that should be used for the primary key.

(Inherited from KeyDiscoveryConvention)
ProcessEntityTypeAdded(IConventionEntityTypeBuilder, IConventionContext<IConventionEntityTypeBuilder>)

Called after an entity type is added to the model.

(Inherited from KeyDiscoveryConvention)
ProcessEntityTypeAnnotationChanged(IConventionEntityTypeBuilder, String, IConventionAnnotation, IConventionAnnotation, IConventionContext<IConventionAnnotation>)

Called after an annotation is changed on an entity type.

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

Called after the base type of an entity type changes.

(Inherited from KeyDiscoveryConvention)
ProcessEntityTypeMemberIgnored(IConventionEntityTypeBuilder, String, IConventionContext<String>)

Called after an entity type member is ignored.

(Inherited from KeyDiscoveryConvention)
ProcessForeignKeyAdded(IConventionForeignKeyBuilder, IConventionContext<IConventionForeignKeyBuilder>)

Called after a foreign key is added to the entity type.

(Inherited from KeyDiscoveryConvention)
ProcessForeignKeyAdded(IConventionRelationshipBuilder, IConventionContext<IConventionRelationshipBuilder>)

Called after a foreign key is added to the entity type.

(Inherited from KeyDiscoveryConvention)
ProcessForeignKeyOwnershipChanged(IConventionForeignKeyBuilder, IConventionContext<Nullable<Boolean>>)

Called after the ownership value for a foreign key is changed.

(Inherited from KeyDiscoveryConvention)
ProcessForeignKeyOwnershipChanged(IConventionRelationshipBuilder, IConventionContext<IConventionRelationshipBuilder>)

Called after the ownership value for a foreign key is changed.

(Inherited from KeyDiscoveryConvention)
ProcessForeignKeyPropertiesChanged(IConventionForeignKeyBuilder, IReadOnlyList<IConventionProperty>, IConventionKey, IConventionContext<IReadOnlyList<IConventionProperty>>)

Called after the foreign key properties or principal key are changed.

(Inherited from KeyDiscoveryConvention)
ProcessForeignKeyPropertiesChanged(IConventionRelationshipBuilder, IReadOnlyList<IConventionProperty>, IConventionKey, IConventionContext<IConventionRelationshipBuilder>)

Called after the foreign key properties or principal key are changed.

(Inherited from KeyDiscoveryConvention)
ProcessForeignKeyRemoved(IConventionEntityTypeBuilder, IConventionForeignKey, IConventionContext<IConventionForeignKey>)

Called after a foreign key is removed.

(Inherited from KeyDiscoveryConvention)
ProcessForeignKeyUniquenessChanged(IConventionForeignKeyBuilder, IConventionContext<Nullable<Boolean>>)

Called after the uniqueness for a foreign key is changed.

(Inherited from KeyDiscoveryConvention)
ProcessForeignKeyUniquenessChanged(IConventionRelationshipBuilder, IConventionContext<IConventionRelationshipBuilder>)

Called after the uniqueness for a foreign key is changed.

(Inherited from KeyDiscoveryConvention)
ProcessKeyProperties(IList<IConventionProperty>, IConventionEntityType)

Adds or removes properties to be used for the primary key.

ProcessKeyRemoved(IConventionEntityTypeBuilder, IConventionKey, IConventionContext<IConventionKey>)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

(Inherited from KeyDiscoveryConvention)
ProcessPropertyAdded(IConventionPropertyBuilder, IConventionContext<IConventionPropertyBuilder>)

Called after a property is added to the entity type.

(Inherited from KeyDiscoveryConvention)
ProcessPropertyFieldChanged(IConventionPropertyBuilder, FieldInfo, FieldInfo, IConventionContext<FieldInfo>)

Called after the backing field for a property is changed.

(Inherited from KeyDiscoveryConvention)
ProcessSkipNavigationForeignKeyChanged(IConventionSkipNavigationBuilder, IConventionForeignKey, IConventionForeignKey, IConventionContext<IConventionForeignKey>)

Called after a skip navigation inverse is changed.

(Inherited from KeyDiscoveryConvention)
ShouldDiscoverKeyProperties(IConventionEntityType)

Determines whether key properties should be discovered for the entity type.

(Inherited from KeyDiscoveryConvention)
TryConfigurePrimaryKey(IConventionEntityTypeBuilder)

Discovers primary key candidates and configures the primary key if found.

(Inherited from KeyDiscoveryConvention)

Applies to