Class NavigationAttributeConventionBase<TAttribute>
- Namespace
- Microsoft.EntityFrameworkCore.Metadata.Conventions
- Assembly
- Microsoft.EntityFrameworkCore.dll
A base type for conventions that perform configuration based on an attribute applied to a navigation.
public abstract class NavigationAttributeConventionBase<TAttribute> where TAttribute : Attribute
Type Parameters
TAttribute
The attribute type to look for.
- Inheritance
-
NavigationAttributeConventionBase<TAttribute>
- Derived
- Inherited Members
Remarks
See Model building conventions for more information and examples.
Constructors
NavigationAttributeConventionBase(ProviderConventionSetBuilderDependencies)
Creates a new instance of NavigationAttributeConventionBase<TAttribute>.
protected NavigationAttributeConventionBase(ProviderConventionSetBuilderDependencies dependencies)
Parameters
dependencies
ProviderConventionSetBuilderDependenciesParameter object containing dependencies for this convention.
Properties
Dependencies
Dependencies for this service.
protected virtual ProviderConventionSetBuilderDependencies Dependencies { get; }
Property Value
Methods
GetAttributes<TCustomAttribute>(IConventionEntityType, IConventionNavigation)
Returns the attributes applied to the given navigation.
protected static IEnumerable<TCustomAttribute> GetAttributes<TCustomAttribute>(IConventionEntityType entityType, IConventionNavigation navigation) where TCustomAttribute : Attribute
Parameters
entityType
IConventionEntityTypeThe entity type.
navigation
IConventionNavigationThe navigation.
Returns
- IEnumerable<TCustomAttribute>
The attributes applied to the given navigation.
Type Parameters
TCustomAttribute
The attribute type to look for.
GetAttributes<TCustomAttribute>(IConventionEntityType, IConventionSkipNavigation)
Returns the attributes applied to the given skip navigation.
protected static IEnumerable<TCustomAttribute> GetAttributes<TCustomAttribute>(IConventionEntityType entityType, IConventionSkipNavigation skipNavigation) where TCustomAttribute : Attribute
Parameters
entityType
IConventionEntityTypeThe entity type.
skipNavigation
IConventionSkipNavigationThe skip navigation.
Returns
- IEnumerable<TCustomAttribute>
The attributes applied to the given skip navigation.
Type Parameters
TCustomAttribute
The attribute type to look for.
ProcessEntityTypeAdded(IConventionEntityTypeBuilder, IConventionContext<IConventionEntityTypeBuilder>)
Called after an entity type is added to the model.
public virtual void ProcessEntityTypeAdded(IConventionEntityTypeBuilder entityTypeBuilder, IConventionContext<IConventionEntityTypeBuilder> context)
Parameters
entityTypeBuilder
IConventionEntityTypeBuilderThe builder for the entity type.
context
IConventionContext<IConventionEntityTypeBuilder>Additional information associated with convention execution.
ProcessEntityTypeAdded(IConventionEntityTypeBuilder, MemberInfo, Type, TAttribute, IConventionContext<IConventionEntityTypeBuilder>)
Called for every navigation property that has an attribute after an entity type is added to the model.
public virtual void ProcessEntityTypeAdded(IConventionEntityTypeBuilder entityTypeBuilder, MemberInfo navigationMemberInfo, Type targetClrType, TAttribute attribute, IConventionContext<IConventionEntityTypeBuilder> context)
Parameters
entityTypeBuilder
IConventionEntityTypeBuilderThe builder for the entity type.
navigationMemberInfo
MemberInfoThe navigation member info.
targetClrType
TypeThe CLR type of the target entity type
attribute
TAttributeThe attribute.
context
IConventionContext<IConventionEntityTypeBuilder>Additional information associated with convention execution.
ProcessEntityTypeBaseTypeChanged(IConventionEntityTypeBuilder, IConventionEntityType?, IConventionEntityType?, IConventionContext<IConventionEntityType>)
Called after the base type of an entity type changes.
public virtual void ProcessEntityTypeBaseTypeChanged(IConventionEntityTypeBuilder entityTypeBuilder, IConventionEntityType? newBaseType, IConventionEntityType? oldBaseType, IConventionContext<IConventionEntityType> context)
Parameters
entityTypeBuilder
IConventionEntityTypeBuilderThe builder for the entity type.
newBaseType
IConventionEntityTypeThe new base entity type.
oldBaseType
IConventionEntityTypeThe old base entity type.
context
IConventionContext<IConventionEntityType>Additional information associated with convention execution.
ProcessEntityTypeBaseTypeChanged(IConventionEntityTypeBuilder, IConventionEntityType?, IConventionEntityType?, MemberInfo, Type, TAttribute, IConventionContext<IConventionEntityType>)
Called for every navigation property that has an attribute after the base type for an entity type is changed.
public virtual void ProcessEntityTypeBaseTypeChanged(IConventionEntityTypeBuilder entityTypeBuilder, IConventionEntityType? newBaseType, IConventionEntityType? oldBaseType, MemberInfo navigationMemberInfo, Type targetClrType, TAttribute attribute, IConventionContext<IConventionEntityType> context)
Parameters
entityTypeBuilder
IConventionEntityTypeBuilderThe builder for the entity type.
newBaseType
IConventionEntityTypeThe new base type.
oldBaseType
IConventionEntityTypeThe old base type.
navigationMemberInfo
MemberInfoThe navigation member info.
targetClrType
TypeThe CLR type of the target entity type.
attribute
TAttributeThe attribute.
context
IConventionContext<IConventionEntityType>Additional information associated with convention execution.
ProcessEntityTypeMemberIgnored(IConventionEntityTypeBuilder, MemberInfo, Type, TAttribute, IConventionContext<string>)
Called after a navigation property that has an attribute is ignored.
public virtual void ProcessEntityTypeMemberIgnored(IConventionEntityTypeBuilder entityTypeBuilder, MemberInfo navigationMemberInfo, Type targetClrType, TAttribute attribute, IConventionContext<string> context)
Parameters
entityTypeBuilder
IConventionEntityTypeBuilderThe builder for the entity type.
navigationMemberInfo
MemberInfoThe navigation member info.
targetClrType
TypeThe CLR type of the target entity type.
attribute
TAttributeThe attribute.
context
IConventionContext<string>Additional information associated with convention execution.
ProcessEntityTypeMemberIgnored(IConventionEntityTypeBuilder, string, IConventionContext<string>)
Called after an entity type member is ignored.
public virtual void ProcessEntityTypeMemberIgnored(IConventionEntityTypeBuilder entityTypeBuilder, string name, IConventionContext<string> context)
Parameters
entityTypeBuilder
IConventionEntityTypeBuilderThe builder for the entity type.
name
stringThe name of the ignored member.
context
IConventionContext<string>Additional information associated with convention execution.
ProcessEntityTypeRemoved(IConventionModelBuilder, IConventionEntityType, IConventionContext<IConventionEntityType>)
Called after an entity type is removed from the model.
public virtual void ProcessEntityTypeRemoved(IConventionModelBuilder modelBuilder, IConventionEntityType entityType, IConventionContext<IConventionEntityType> context)
Parameters
modelBuilder
IConventionModelBuilderThe builder for the model.
entityType
IConventionEntityTypeThe removed entity type.
context
IConventionContext<IConventionEntityType>Additional information associated with convention execution.
ProcessEntityTypeRemoved(IConventionModelBuilder, IConventionEntityType, MemberInfo, Type, TAttribute, IConventionContext<IConventionEntityType>)
Called for every navigation property that has an attribute after an entity type is removed.
public virtual void ProcessEntityTypeRemoved(IConventionModelBuilder modelBuilder, IConventionEntityType entityType, MemberInfo navigationMemberInfo, Type targetClrType, TAttribute attribute, IConventionContext<IConventionEntityType> context)
Parameters
modelBuilder
IConventionModelBuilderThe builder for the model.
entityType
IConventionEntityTypeThe ignored entity type.
navigationMemberInfo
MemberInfoThe navigation member info.
targetClrType
TypeThe CLR type of the target entity type.
attribute
TAttributeThe attribute.
context
IConventionContext<IConventionEntityType>Additional information associated with convention execution.
ProcessForeignKeyPrincipalEndChanged(IConventionForeignKeyBuilder, IConventionContext<IConventionForeignKeyBuilder>)
Called after the principal end of a foreign key is changed.
public virtual void ProcessForeignKeyPrincipalEndChanged(IConventionForeignKeyBuilder relationshipBuilder, IConventionContext<IConventionForeignKeyBuilder> context)
Parameters
relationshipBuilder
IConventionForeignKeyBuilderThe builder for the foreign key.
context
IConventionContext<IConventionForeignKeyBuilder>Additional information associated with convention execution.
ProcessForeignKeyPrincipalEndChanged(IConventionForeignKeyBuilder, IEnumerable<TAttribute>?, IEnumerable<TAttribute>?, IConventionContext<IConventionForeignKeyBuilder>)
Called after the principal end of a foreign key is changed.
public virtual void ProcessForeignKeyPrincipalEndChanged(IConventionForeignKeyBuilder relationshipBuilder, IEnumerable<TAttribute>? dependentToPrincipalAttributes, IEnumerable<TAttribute>? principalToDependentAttributes, IConventionContext<IConventionForeignKeyBuilder> context)
Parameters
relationshipBuilder
IConventionForeignKeyBuilderThe builder for the foreign key.
dependentToPrincipalAttributes
IEnumerable<TAttribute>The attributes on the dependent to principal navigation.
principalToDependentAttributes
IEnumerable<TAttribute>The attributes on the principal to dependent navigation.
context
IConventionContext<IConventionForeignKeyBuilder>Additional information associated with convention execution.
ProcessNavigationAdded(IConventionNavigationBuilder, IConventionContext<IConventionNavigationBuilder>)
Called after a navigation is added to the entity type.
public virtual void ProcessNavigationAdded(IConventionNavigationBuilder navigationBuilder, IConventionContext<IConventionNavigationBuilder> context)
Parameters
navigationBuilder
IConventionNavigationBuilderThe builder for the navigation.
context
IConventionContext<IConventionNavigationBuilder>Additional information associated with convention execution.
ProcessNavigationAdded(IConventionNavigationBuilder, TAttribute, IConventionContext<IConventionNavigationBuilder>)
Called after a navigation property that has an attribute is added to an entity type.
public virtual void ProcessNavigationAdded(IConventionNavigationBuilder navigationBuilder, TAttribute attribute, IConventionContext<IConventionNavigationBuilder> context)
Parameters
navigationBuilder
IConventionNavigationBuilderThe builder for the navigation.
attribute
TAttributeThe attribute.
context
IConventionContext<IConventionNavigationBuilder>Additional information associated with convention execution.
ProcessSkipNavigationAdded(IConventionSkipNavigationBuilder, IConventionContext<IConventionSkipNavigationBuilder>)
Called after a skip navigation is added to the entity type.
public virtual void ProcessSkipNavigationAdded(IConventionSkipNavigationBuilder skipNavigationBuilder, IConventionContext<IConventionSkipNavigationBuilder> context)
Parameters
skipNavigationBuilder
IConventionSkipNavigationBuilderThe builder for the skip navigation.
context
IConventionContext<IConventionSkipNavigationBuilder>Additional information associated with convention execution.
ProcessSkipNavigationAdded(IConventionSkipNavigationBuilder, TAttribute, IConventionContext<IConventionSkipNavigationBuilder>)
Called after a skip navigation property that has an attribute is added to an entity type.
public virtual void ProcessSkipNavigationAdded(IConventionSkipNavigationBuilder skipNavigationBuilder, TAttribute attribute, IConventionContext<IConventionSkipNavigationBuilder> context)
Parameters
skipNavigationBuilder
IConventionSkipNavigationBuilderThe builder for the navigation.
attribute
TAttributeThe attribute.
context
IConventionContext<IConventionSkipNavigationBuilder>Additional information associated with convention execution.
ProcessTypeIgnored(IConventionModelBuilder, string, Type?, IConventionContext<string>)
Called after an entity type is ignored.
public virtual void ProcessTypeIgnored(IConventionModelBuilder modelBuilder, string name, Type? type, IConventionContext<string> context)
Parameters
modelBuilder
IConventionModelBuilderThe builder for the model.
name
stringThe name of the ignored entity type.
type
TypeThe ignored entity type.
context
IConventionContext<string>Additional information associated with convention execution.
ProcessTypeIgnored(IConventionModelBuilder, Type, MemberInfo, Type, TAttribute, IConventionContext<string>)
Called for every navigation property that has an attribute after an entity type is ignored.
public virtual void ProcessTypeIgnored(IConventionModelBuilder modelBuilder, Type type, MemberInfo navigationMemberInfo, Type targetClrType, TAttribute attribute, IConventionContext<string> context)
Parameters
modelBuilder
IConventionModelBuilderThe builder for the model.
type
TypeThe ignored entity type.
navigationMemberInfo
MemberInfoThe navigation member info.
targetClrType
TypeThe CLR type of the target entity type.
attribute
TAttributeThe attribute.
context
IConventionContext<string>Additional information associated with convention execution.