Table of Contents

Class RequiredPropertyAttributeConvention

Namespace
Microsoft.EntityFrameworkCore.Metadata.Conventions
Assembly
Microsoft.EntityFrameworkCore.dll

A convention that configures properties as required if they have the RequiredAttribute applied.

public class RequiredPropertyAttributeConvention : PropertyAttributeConventionBase<RequiredAttribute>, IPropertyAddedConvention, IPropertyFieldChangedConvention, IComplexPropertyAddedConvention, IComplexPropertyFieldChangedConvention, IConvention
Inheritance
RequiredPropertyAttributeConvention
Implements
Inherited Members

Remarks

See Model building conventions for more information and examples.

Constructors

RequiredPropertyAttributeConvention(ProviderConventionSetBuilderDependencies)

Creates a new instance of RequiredPropertyAttributeConvention.

public RequiredPropertyAttributeConvention(ProviderConventionSetBuilderDependencies dependencies)

Parameters

dependencies ProviderConventionSetBuilderDependencies

Parameter object containing dependencies for this convention.

Methods

ProcessPropertyAdded(IConventionComplexPropertyBuilder, RequiredAttribute, MemberInfo, IConventionContext)

protected override void ProcessPropertyAdded(IConventionComplexPropertyBuilder propertyBuilder, RequiredAttribute attribute, MemberInfo clrMember, IConventionContext context)

Parameters

propertyBuilder IConventionComplexPropertyBuilder
attribute RequiredAttribute
clrMember MemberInfo
context IConventionContext

ProcessPropertyAdded(IConventionPropertyBuilder, RequiredAttribute, MemberInfo, IConventionContext)

protected override void ProcessPropertyAdded(IConventionPropertyBuilder propertyBuilder, RequiredAttribute attribute, MemberInfo clrMember, IConventionContext context)

Parameters

propertyBuilder IConventionPropertyBuilder
attribute RequiredAttribute
clrMember MemberInfo
context IConventionContext