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)
Creates a new instance of PropertyAttributeConventionBase<TAttribute>.
protected PropertyAttributeConventionBase(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
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
IConventionComplexPropertyBuilderThe 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
IConventionComplexPropertyBuilderThe builder for the property.
newFieldInfo
FieldInfoThe new field.
oldFieldInfo
FieldInfoThe 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
IConventionComplexPropertyBuilderThe builder for the property.
attribute
TAttributeThe attribute.
clrMember
MemberInfoThe member that has the attribute.
context
IConventionContextAdditional information associated with convention execution.
ProcessPropertyAdded(IConventionPropertyBuilder, IConventionContext<IConventionPropertyBuilder>)
public virtual void ProcessPropertyAdded(IConventionPropertyBuilder propertyBuilder, IConventionContext<IConventionPropertyBuilder> context)
Parameters
propertyBuilder
IConventionPropertyBuildercontext
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
IConventionPropertyBuilderThe builder for the property.
attribute
TAttributeThe attribute.
clrMember
MemberInfoThe member that has the attribute.
context
IConventionContextAdditional 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
IConventionPropertyBuildernewFieldInfo
FieldInfooldFieldInfo
FieldInfocontext
IConventionContext<FieldInfo>