ForeignKeyPropertyDiscoveryConvention Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A convention that finds foreign key properties for relationships based on their names, ignoring case:
- [navigation property name][principal key property name]
- [navigation property name]Id
- [principal entity name][principal key property name]
- [principal entity name]Id
public class ForeignKeyPropertyDiscoveryConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeMemberIgnoredConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypePrimaryKeyChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyPrincipalEndChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyPropertiesChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyRequirednessChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyUniquenessChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IModelFinalizedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.INavigationAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyFieldChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyNullabilityChangedConvention
public class ForeignKeyPropertyDiscoveryConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeMemberIgnoredConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypePrimaryKeyChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyPrincipalEndChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyPropertiesChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyRequirednessChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyUniquenessChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IModelFinalizingConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.INavigationAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyFieldChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IPropertyNullabilityChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.ISkipNavigationForeignKeyChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.ISkipNavigationInverseChangedConvention
type ForeignKeyPropertyDiscoveryConvention = class
interface IForeignKeyAddedConvention
interface IConvention
interface INavigationAddedConvention
interface IPropertyAddedConvention
interface IEntityTypeMemberIgnoredConvention
interface IPropertyNullabilityChangedConvention
interface IPropertyFieldChangedConvention
interface IForeignKeyPropertiesChangedConvention
interface IForeignKeyPrincipalEndChangedConvention
interface IForeignKeyUniquenessChangedConvention
interface IForeignKeyRequirednessChangedConvention
interface IKeyAddedConvention
interface IKeyRemovedConvention
interface IEntityTypePrimaryKeyChangedConvention
interface IModelFinalizedConvention
type ForeignKeyPropertyDiscoveryConvention = class
interface IEntityTypeMemberIgnoredConvention
interface IConvention
interface IEntityTypePrimaryKeyChangedConvention
interface IForeignKeyAddedConvention
interface IForeignKeyPropertiesChangedConvention
interface IForeignKeyPrincipalEndChangedConvention
interface IForeignKeyUniquenessChangedConvention
interface IForeignKeyRequirednessChangedConvention
interface IKeyAddedConvention
interface IKeyRemovedConvention
interface INavigationAddedConvention
interface ISkipNavigationForeignKeyChangedConvention
interface ISkipNavigationInverseChangedConvention
interface IPropertyAddedConvention
interface IPropertyNullabilityChangedConvention
interface IPropertyFieldChangedConvention
interface IModelFinalizingConvention
Public Class ForeignKeyPropertyDiscoveryConvention
Implements IEntityTypeMemberIgnoredConvention, IEntityTypePrimaryKeyChangedConvention, IForeignKeyAddedConvention, IForeignKeyPrincipalEndChangedConvention, IForeignKeyPropertiesChangedConvention, IForeignKeyRequirednessChangedConvention, IForeignKeyUniquenessChangedConvention, IKeyAddedConvention, IKeyRemovedConvention, IModelFinalizedConvention, INavigationAddedConvention, IPropertyAddedConvention, IPropertyFieldChangedConvention, IPropertyNullabilityChangedConvention
Public Class ForeignKeyPropertyDiscoveryConvention
Implements IEntityTypeMemberIgnoredConvention, IEntityTypePrimaryKeyChangedConvention, IForeignKeyAddedConvention, IForeignKeyPrincipalEndChangedConvention, IForeignKeyPropertiesChangedConvention, IForeignKeyRequirednessChangedConvention, IForeignKeyUniquenessChangedConvention, IKeyAddedConvention, IKeyRemovedConvention, IModelFinalizingConvention, INavigationAddedConvention, IPropertyAddedConvention, IPropertyFieldChangedConvention, IPropertyNullabilityChangedConvention, ISkipNavigationForeignKeyChangedConvention, ISkipNavigationInverseChangedConvention
- Inheritance
-
ForeignKeyPropertyDiscoveryConvention
- Implements
-
IConvention IEntityTypeMemberIgnoredConvention IEntityTypePrimaryKeyChangedConvention IForeignKeyAddedConvention IForeignKeyPrincipalEndChangedConvention IForeignKeyPropertiesChangedConvention IForeignKeyRequirednessChangedConvention IForeignKeyUniquenessChangedConvention IKeyAddedConvention IKeyRemovedConvention IModelFinalizedConvention INavigationAddedConvention IPropertyAddedConvention IPropertyFieldChangedConvention IPropertyNullabilityChangedConvention IModelFinalizingConvention ISkipNavigationForeignKeyChangedConvention ISkipNavigationInverseChangedConvention
Remarks
If no matching properties were found, the relationship doesn't represent an ownership, the dependent side is not ambiguous and not derived then if the relationship is one-to-one, the primary key properties are used, otherwise the convention tries to match properties with the exact name as principal key properties if they are a proper subset of the dependent PK.
If a match was found, but the property types are not compatible with the principal key types no further matches are searched for.
If the relationship uses shadow properties created by convention they are recreated to remove suffixes used to make the names unique.
See Model building conventions for more information and examples.
Constructors
ForeignKeyPropertyDiscoveryConvention(ProviderConventionSetBuilderDependencies) |
Creates a new instance of ForeignKeyPropertyDiscoveryConvention. |
Properties
Dependencies |
Dependencies for this service. |
Methods
Applies to
Entity Framework