KeyDiscoveryConvention Класс

Определение

Соглашение, которое находит свойство первичного ключа для типа сущности на основе имен, игнорируя регистр:

  • Идентификатор
  • [имя сущности] Id
public class KeyDiscoveryConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeBaseTypeChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyOwnershipChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyPropertiesChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyUniquenessChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyFieldChangedConvention
public class KeyDiscoveryConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeBaseTypeChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyOwnershipChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyPropertiesChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyUniquenessChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.ISkipNavigationForeignKeyChangedConvention
public class KeyDiscoveryConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeBaseTypeChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeMemberIgnoredConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyOwnershipChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyPropertiesChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyUniquenessChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.ISkipNavigationForeignKeyChangedConvention
type KeyDiscoveryConvention = class
    interface IEntityTypeAddedConvention
    interface IConvention
    interface IPropertyAddedConvention
    interface IKeyRemovedConvention
    interface IEntityTypeBaseTypeChangedConvention
    interface IPropertyFieldChangedConvention
    interface IForeignKeyAddedConvention
    interface IForeignKeyRemovedConvention
    interface IForeignKeyPropertiesChangedConvention
    interface IForeignKeyUniquenessChangedConvention
    interface IForeignKeyOwnershipChangedConvention
type KeyDiscoveryConvention = class
    interface IEntityTypeAddedConvention
    interface IConvention
    interface IPropertyAddedConvention
    interface IKeyRemovedConvention
    interface IEntityTypeBaseTypeChangedConvention
    interface IForeignKeyAddedConvention
    interface IForeignKeyRemovedConvention
    interface IForeignKeyPropertiesChangedConvention
    interface IForeignKeyUniquenessChangedConvention
    interface IForeignKeyOwnershipChangedConvention
    interface ISkipNavigationForeignKeyChangedConvention
type KeyDiscoveryConvention = class
    interface IEntityTypeAddedConvention
    interface IConvention
    interface IPropertyAddedConvention
    interface IKeyRemovedConvention
    interface IEntityTypeBaseTypeChangedConvention
    interface IEntityTypeMemberIgnoredConvention
    interface IForeignKeyAddedConvention
    interface IForeignKeyRemovedConvention
    interface IForeignKeyPropertiesChangedConvention
    interface IForeignKeyUniquenessChangedConvention
    interface IForeignKeyOwnershipChangedConvention
    interface ISkipNavigationForeignKeyChangedConvention
Public Class KeyDiscoveryConvention
Implements IEntityTypeAddedConvention, IEntityTypeBaseTypeChangedConvention, IForeignKeyAddedConvention, IForeignKeyOwnershipChangedConvention, IForeignKeyPropertiesChangedConvention, IForeignKeyRemovedConvention, IForeignKeyUniquenessChangedConvention, IKeyRemovedConvention, IPropertyAddedConvention, IPropertyFieldChangedConvention
Public Class KeyDiscoveryConvention
Implements IEntityTypeAddedConvention, IEntityTypeBaseTypeChangedConvention, IForeignKeyAddedConvention, IForeignKeyOwnershipChangedConvention, IForeignKeyPropertiesChangedConvention, IForeignKeyRemovedConvention, IForeignKeyUniquenessChangedConvention, IKeyRemovedConvention, IPropertyAddedConvention, ISkipNavigationForeignKeyChangedConvention
Public Class KeyDiscoveryConvention
Implements IEntityTypeAddedConvention, IEntityTypeBaseTypeChangedConvention, IEntityTypeMemberIgnoredConvention, IForeignKeyAddedConvention, IForeignKeyOwnershipChangedConvention, IForeignKeyPropertiesChangedConvention, IForeignKeyRemovedConvention, IForeignKeyUniquenessChangedConvention, IKeyRemovedConvention, IPropertyAddedConvention, ISkipNavigationForeignKeyChangedConvention
Наследование
KeyDiscoveryConvention
Производный
Реализации

Комментарии

Если тип сущности принадлежит через эталонное свойство навигации, то используются соответствующие свойства внешнего ключа.

Если тип сущности принадлежит через свойство навигации коллекции, то составной первичный ключ настраивается с помощью свойств внешнего ключа с дополнительным свойством, которое соответствует соглашению об именовании выше.

Дополнительные сведения и примеры см. в разделе Соглашения о создании моделей .

Конструкторы

KeyDiscoveryConvention(ProviderConventionSetBuilderDependencies)

Создает новый экземпляр KeyDiscoveryConvention.

Свойства

Dependencies

Зависимости для этой службы.

Методы

DiscoverKeyProperties(IConventionEntityType, IEnumerable<IConventionProperty>)

Возвращает свойства, которые следует использовать для первичного ключа.

ProcessEntityTypeAdded(IConventionEntityTypeBuilder, IConventionContext<IConventionEntityTypeBuilder>)

Вызывается после добавления типа сущности в модель.

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

Вызывается после изменения базового типа сущности.

ProcessEntityTypeMemberIgnored(IConventionEntityTypeBuilder, String, IConventionContext<String>)

Вызывается после того, как элемент типа сущности игнорируется.

ProcessForeignKeyAdded(IConventionForeignKeyBuilder, IConventionContext<IConventionForeignKeyBuilder>)

Вызывается после добавления внешнего ключа к типу сущности.

ProcessForeignKeyAdded(IConventionRelationshipBuilder, IConventionContext<IConventionRelationshipBuilder>)

Вызывается после добавления внешнего ключа к типу сущности.

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

Вызывается после изменения значения владения для внешнего ключа.

ProcessForeignKeyOwnershipChanged(IConventionRelationshipBuilder, IConventionContext<IConventionRelationshipBuilder>)

Вызывается после изменения значения владения для внешнего ключа.

ProcessForeignKeyPropertiesChanged(IConventionForeignKeyBuilder, IReadOnlyList<IConventionProperty>, IConventionKey, IConventionContext<IReadOnlyList<IConventionProperty>>)

Вызывается после изменения свойств внешнего ключа или основного ключа.

ProcessForeignKeyPropertiesChanged(IConventionRelationshipBuilder, IReadOnlyList<IConventionProperty>, IConventionKey, IConventionContext<IConventionRelationshipBuilder>)

Вызывается после изменения свойств внешнего ключа или основного ключа.

ProcessForeignKeyRemoved(IConventionEntityTypeBuilder, IConventionForeignKey, IConventionContext<IConventionForeignKey>)

Вызывается после удаления внешнего ключа.

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

Вызывается после изменения уникальности внешнего ключа.

ProcessForeignKeyUniquenessChanged(IConventionRelationshipBuilder, IConventionContext<IConventionRelationshipBuilder>)

Вызывается после изменения уникальности внешнего ключа.

ProcessKeyProperties(IList<IConventionProperty>, IConventionEntityType)

Добавляет или удаляет свойства, используемые для первичного ключа.

ProcessKeyRemoved(IConventionEntityTypeBuilder, IConventionKey, IConventionContext<IConventionKey>)

Это внутренний API, который поддерживает инфраструктуру Entity Framework Core и не подчиняется тем же стандартам совместимости, что и общедоступные API. Он может быть изменен или удален без уведомления в любом выпуске. Его следует использовать только непосредственно в коде с особой осторожностью, зная, что это может привести к сбоям приложений при обновлении до нового выпуска Entity Framework Core.

ProcessPropertyAdded(IConventionPropertyBuilder, IConventionContext<IConventionPropertyBuilder>)

Вызывается после добавления свойства к типу сущности.

ProcessPropertyFieldChanged(IConventionPropertyBuilder, FieldInfo, FieldInfo, IConventionContext<FieldInfo>)

Вызывается после изменения резервного поля для свойства.

ProcessSkipNavigationForeignKeyChanged(IConventionSkipNavigationBuilder, IConventionForeignKey, IConventionForeignKey, IConventionContext<IConventionForeignKey>)

Вызывается после изменения обратной навигации skip.

TryConfigurePrimaryKey(IConventionEntityTypeBuilder)

Обнаруживает кандидатов первичного ключа и настраивает первичный ключ, если он найден.

Применяется к