Table of Contents

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)

protected NavigationAttributeConventionBase(ProviderConventionSetBuilderDependencies dependencies)

Parameters

dependencies ProviderConventionSetBuilderDependencies

Parameter object containing dependencies for this convention.

Properties

Dependencies

Dependencies for this service.

protected virtual ProviderConventionSetBuilderDependencies Dependencies { get; }

Property Value

ProviderConventionSetBuilderDependencies

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 IConventionEntityType

The entity type.

navigation IConventionNavigation

The 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 IConventionEntityType

The entity type.

skipNavigation IConventionSkipNavigation

The 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 IConventionEntityTypeBuilder

The 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 IConventionEntityTypeBuilder

The builder for the entity type.

navigationMemberInfo MemberInfo

The navigation member info.

targetClrType Type

The CLR type of the target entity type

attribute TAttribute

The 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 IConventionEntityTypeBuilder

The builder for the entity type.

newBaseType IConventionEntityType

The new base entity type.

oldBaseType IConventionEntityType

The 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 IConventionEntityTypeBuilder

The builder for the entity type.

newBaseType IConventionEntityType

The new base type.

oldBaseType IConventionEntityType

The old base type.

navigationMemberInfo MemberInfo

The navigation member info.

targetClrType Type

The CLR type of the target entity type.

attribute TAttribute

The 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 IConventionEntityTypeBuilder

The builder for the entity type.

navigationMemberInfo MemberInfo

The navigation member info.

targetClrType Type

The CLR type of the target entity type.

attribute TAttribute

The 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 IConventionEntityTypeBuilder

The builder for the entity type.

name string

The 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 IConventionModelBuilder

The builder for the model.

entityType IConventionEntityType

The 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 IConventionModelBuilder

The builder for the model.

entityType IConventionEntityType

The ignored entity type.

navigationMemberInfo MemberInfo

The navigation member info.

targetClrType Type

The CLR type of the target entity type.

attribute TAttribute

The 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 IConventionForeignKeyBuilder

The 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 IConventionForeignKeyBuilder

The 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 IConventionNavigationBuilder

The 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 IConventionNavigationBuilder

The builder for the navigation.

attribute TAttribute

The 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 IConventionSkipNavigationBuilder

The 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 IConventionSkipNavigationBuilder

The builder for the navigation.

attribute TAttribute

The 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 IConventionModelBuilder

The builder for the model.

name string

The name of the ignored entity type.

type Type

The 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 IConventionModelBuilder

The builder for the model.

type Type

The ignored entity type.

navigationMemberInfo MemberInfo

The navigation member info.

targetClrType Type

The CLR type of the target entity type.

attribute TAttribute

The attribute.

context IConventionContext<string>

Additional information associated with convention execution.