Table of Contents

Class PropertyAttributeConventionBase<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 property.

public abstract class PropertyAttributeConventionBase<TAttribute> : IPropertyAddedConvention, IPropertyFieldChangedConvention, IConvention where TAttribute : Attribute

Type Parameters

TAttribute

The attribute type to look for.

Inheritance
PropertyAttributeConventionBase<TAttribute>
Implements
Derived
Inherited Members

Remarks

The deriving class must implement IPropertyAddedConvention and IPropertyFieldChangedConvention to also handle complex properties.

See Model building conventions for more information and examples.

Constructors

PropertyAttributeConventionBase(ProviderConventionSetBuilderDependencies)

protected PropertyAttributeConventionBase(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

ProcessComplexPropertyAdded(IConventionComplexPropertyBuilder, IConventionContext<IConventionComplexPropertyBuilder>)

Called after a complex property is added to an type-like object.

public virtual void ProcessComplexPropertyAdded(IConventionComplexPropertyBuilder propertyBuilder, IConventionContext<IConventionComplexPropertyBuilder> context)

Parameters

propertyBuilder IConventionComplexPropertyBuilder

The builder for the complex property.

context IConventionContext<IConventionComplexPropertyBuilder>

Additional information associated with convention execution.

ProcessComplexPropertyFieldChanged(IConventionComplexPropertyBuilder, FieldInfo?, FieldInfo?, IConventionContext<FieldInfo>)

Called after the backing field for a complex property is changed.

public virtual void ProcessComplexPropertyFieldChanged(IConventionComplexPropertyBuilder propertyBuilder, FieldInfo? newFieldInfo, FieldInfo? oldFieldInfo, IConventionContext<FieldInfo> context)

Parameters

propertyBuilder IConventionComplexPropertyBuilder

The builder for the property.

newFieldInfo FieldInfo

The new field.

oldFieldInfo FieldInfo

The old field.

context IConventionContext<FieldInfo>

Additional information associated with convention execution.

ProcessPropertyAdded(IConventionComplexPropertyBuilder, TAttribute, MemberInfo, IConventionContext)

Called after a complex property is added to a type with an attribute on the associated CLR property or field.

protected virtual void ProcessPropertyAdded(IConventionComplexPropertyBuilder propertyBuilder, TAttribute attribute, MemberInfo clrMember, IConventionContext context)

Parameters

propertyBuilder IConventionComplexPropertyBuilder

The builder for the property.

attribute TAttribute

The attribute.

clrMember MemberInfo

The member that has the attribute.

context IConventionContext

Additional information associated with convention execution.

ProcessPropertyAdded(IConventionPropertyBuilder, IConventionContext<IConventionPropertyBuilder>)

public virtual void ProcessPropertyAdded(IConventionPropertyBuilder propertyBuilder, IConventionContext<IConventionPropertyBuilder> context)

Parameters

propertyBuilder IConventionPropertyBuilder
context IConventionContext<IConventionPropertyBuilder>

ProcessPropertyAdded(IConventionPropertyBuilder, TAttribute, MemberInfo, IConventionContext)

Called after a property is added to the entity type with an attribute on the associated CLR property or field.

protected abstract void ProcessPropertyAdded(IConventionPropertyBuilder propertyBuilder, TAttribute attribute, MemberInfo clrMember, IConventionContext context)

Parameters

propertyBuilder IConventionPropertyBuilder

The builder for the property.

attribute TAttribute

The attribute.

clrMember MemberInfo

The member that has the attribute.

context IConventionContext

Additional information associated with convention execution.

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

public virtual void ProcessPropertyFieldChanged(IConventionPropertyBuilder propertyBuilder, FieldInfo? newFieldInfo, FieldInfo? oldFieldInfo, IConventionContext<FieldInfo> context)

Parameters

propertyBuilder IConventionPropertyBuilder
newFieldInfo FieldInfo
oldFieldInfo FieldInfo
context IConventionContext<FieldInfo>