Class ConventionSet
- Namespace
- Microsoft.EntityFrameworkCore.Metadata.Conventions
- Assembly
- Microsoft.EntityFrameworkCore.dll
Represents a set of conventions used to build a model.
public class ConventionSet
- Inheritance
-
ConventionSet
- Inherited Members
Remarks
See Model building conventions for more information and examples.
Constructors
ConventionSet()
public ConventionSet()
Properties
ComplexPropertyAddedConventions
Conventions to run when an entity type is added to the model.
public virtual List<IComplexPropertyAddedConvention> ComplexPropertyAddedConventions { get; }
Property Value
ComplexPropertyAnnotationChangedConventions
Conventions to run when an annotation is set or removed on a complex property.
public virtual List<IComplexPropertyAnnotationChangedConvention> ComplexPropertyAnnotationChangedConventions { get; }
Property Value
ComplexPropertyFieldChangedConventions
Conventions to run when the field of a property is changed.
public virtual List<IComplexPropertyFieldChangedConvention> ComplexPropertyFieldChangedConventions { get; }
Property Value
ComplexPropertyNullabilityChangedConventions
Conventions to run when the nullability of a property is changed.
public virtual List<IComplexPropertyNullabilityChangedConvention> ComplexPropertyNullabilityChangedConventions { get; }
Property Value
ComplexPropertyRemovedConventions
Conventions to run when an entity type is removed.
public virtual List<IComplexPropertyRemovedConvention> ComplexPropertyRemovedConventions { get; }
Property Value
ComplexTypeAnnotationChangedConventions
Conventions to run when an annotation is set or removed on a complex type.
public virtual List<IComplexTypeAnnotationChangedConvention> ComplexTypeAnnotationChangedConventions { get; }
Property Value
ComplexTypeMemberIgnoredConventions
Conventions to run when a property is ignored.
public virtual List<IComplexTypeMemberIgnoredConvention> ComplexTypeMemberIgnoredConventions { get; }
Property Value
DiscriminatorPropertySetConventions
Conventions to run when a discriminator property is set.
public virtual List<IDiscriminatorPropertySetConvention> DiscriminatorPropertySetConventions { get; }
Property Value
ElementTypeAnnotationChangedConventions
Conventions to run when an annotation is changed on the element of a collection.
public virtual List<IElementTypeAnnotationChangedConvention> ElementTypeAnnotationChangedConventions { get; }
Property Value
ElementTypeNullabilityChangedConventions
Conventions to run when the nullability of the element of a collection is changed.
public virtual List<IElementTypeNullabilityChangedConvention> ElementTypeNullabilityChangedConventions { get; }
Property Value
EntityTypeAddedConventions
Conventions to run when an entity type is added to the model.
public virtual List<IEntityTypeAddedConvention> EntityTypeAddedConventions { get; }
Property Value
EntityTypeAnnotationChangedConventions
Conventions to run when an annotation is set or removed on an entity type.
public virtual List<IEntityTypeAnnotationChangedConvention> EntityTypeAnnotationChangedConventions { get; }
Property Value
EntityTypeBaseTypeChangedConventions
Conventions to run when the base entity type is changed.
public virtual List<IEntityTypeBaseTypeChangedConvention> EntityTypeBaseTypeChangedConventions { get; }
Property Value
EntityTypeMemberIgnoredConventions
Conventions to run when a property is ignored.
public virtual List<IEntityTypeMemberIgnoredConvention> EntityTypeMemberIgnoredConventions { get; }
Property Value
EntityTypePrimaryKeyChangedConventions
Conventions to run when a primary key is changed.
public virtual List<IEntityTypePrimaryKeyChangedConvention> EntityTypePrimaryKeyChangedConventions { get; }
Property Value
EntityTypeRemovedConventions
Conventions to run when an entity type is removed.
public virtual List<IEntityTypeRemovedConvention> EntityTypeRemovedConventions { get; }
Property Value
ForeignKeyAddedConventions
Conventions to run when a foreign key is added.
public virtual List<IForeignKeyAddedConvention> ForeignKeyAddedConventions { get; }
Property Value
ForeignKeyAnnotationChangedConventions
Conventions to run when an annotation is changed on a foreign key.
public virtual List<IForeignKeyAnnotationChangedConvention> ForeignKeyAnnotationChangedConventions { get; }
Property Value
ForeignKeyDependentRequirednessChangedConventions
Conventions to run when the requiredness of a foreign key is changed.
public virtual List<IForeignKeyDependentRequirednessChangedConvention> ForeignKeyDependentRequirednessChangedConventions { get; }
Property Value
ForeignKeyNullNavigationSetConventions
Conventions to run when a navigation is set to null on a foreign key.
public virtual List<IForeignKeyNullNavigationSetConvention> ForeignKeyNullNavigationSetConventions { get; }
Property Value
ForeignKeyOwnershipChangedConventions
Conventions to run when the ownership of a foreign key is changed.
public virtual List<IForeignKeyOwnershipChangedConvention> ForeignKeyOwnershipChangedConventions { get; }
Property Value
ForeignKeyPrincipalEndChangedConventions
Conventions to run when the principal end of a relationship is configured.
public virtual List<IForeignKeyPrincipalEndChangedConvention> ForeignKeyPrincipalEndChangedConventions { get; }
Property Value
ForeignKeyPropertiesChangedConventions
Conventions to run when the properties or the principal key of a foreign key are changed.
public virtual List<IForeignKeyPropertiesChangedConvention> ForeignKeyPropertiesChangedConventions { get; }
Property Value
ForeignKeyRemovedConventions
Conventions to run when a foreign key is removed.
public virtual List<IForeignKeyRemovedConvention> ForeignKeyRemovedConventions { get; }
Property Value
ForeignKeyRequirednessChangedConventions
Conventions to run when the requiredness of a foreign key is changed.
public virtual List<IForeignKeyRequirednessChangedConvention> ForeignKeyRequirednessChangedConventions { get; }
Property Value
ForeignKeyUniquenessChangedConventions
Conventions to run when the uniqueness of a foreign key is changed.
public virtual List<IForeignKeyUniquenessChangedConvention> ForeignKeyUniquenessChangedConventions { get; }
Property Value
IndexAddedConventions
Conventions to run when an index is added.
public virtual List<IIndexAddedConvention> IndexAddedConventions { get; }
Property Value
IndexAnnotationChangedConventions
Conventions to run when an annotation is changed on an index.
public virtual List<IIndexAnnotationChangedConvention> IndexAnnotationChangedConventions { get; }
Property Value
IndexRemovedConventions
Conventions to run when an index is removed.
public virtual List<IIndexRemovedConvention> IndexRemovedConventions { get; }
Property Value
IndexSortOrderChangedConventions
Conventions to run when the sort order of an index is changed.
public virtual List<IIndexSortOrderChangedConvention> IndexSortOrderChangedConventions { get; }
Property Value
IndexUniquenessChangedConventions
Conventions to run when the uniqueness of an index is changed.
public virtual List<IIndexUniquenessChangedConvention> IndexUniquenessChangedConventions { get; }
Property Value
KeyAddedConventions
Conventions to run when a key is added.
public virtual List<IKeyAddedConvention> KeyAddedConventions { get; }
Property Value
KeyAnnotationChangedConventions
Conventions to run when an annotation is changed on a key.
public virtual List<IKeyAnnotationChangedConvention> KeyAnnotationChangedConventions { get; }
Property Value
KeyRemovedConventions
Conventions to run when a key is removed.
public virtual List<IKeyRemovedConvention> KeyRemovedConventions { get; }
Property Value
ModelAnnotationChangedConventions
Conventions to run when an annotation is set or removed on a model.
public virtual List<IModelAnnotationChangedConvention> ModelAnnotationChangedConventions { get; }
Property Value
ModelFinalizedConventions
Conventions to run when model validation is completed.
public virtual List<IModelFinalizedConvention> ModelFinalizedConventions { get; }
Property Value
ModelFinalizingConventions
Conventions to run when model building is completed.
public virtual List<IModelFinalizingConvention> ModelFinalizingConventions { get; }
Property Value
ModelInitializedConventions
Conventions to run to setup the initial model.
public virtual List<IModelInitializedConvention> ModelInitializedConventions { get; }
Property Value
NavigationAddedConventions
Conventions to run when a navigation property is added.
public virtual List<INavigationAddedConvention> NavigationAddedConventions { get; }
Property Value
NavigationAnnotationChangedConventions
Conventions to run when an annotation is changed on a navigation property.
public virtual List<INavigationAnnotationChangedConvention> NavigationAnnotationChangedConventions { get; }
Property Value
NavigationRemovedConventions
Conventions to run when a navigation property is removed.
public virtual List<INavigationRemovedConvention> NavigationRemovedConventions { get; }
Property Value
PropertyAddedConventions
Conventions to run when a property is added.
public virtual List<IPropertyAddedConvention> PropertyAddedConventions { get; }
Property Value
PropertyAnnotationChangedConventions
Conventions to run when an annotation is changed on a property.
public virtual List<IPropertyAnnotationChangedConvention> PropertyAnnotationChangedConventions { get; }
Property Value
PropertyElementTypeChangedConventions
Conventions to run when the field of a property is changed.
public virtual List<IPropertyElementTypeChangedConvention> PropertyElementTypeChangedConventions { get; }
Property Value
PropertyFieldChangedConventions
Conventions to run when the field of a property is changed.
public virtual List<IPropertyFieldChangedConvention> PropertyFieldChangedConventions { get; }
Property Value
PropertyNullabilityChangedConventions
Conventions to run when the nullability of a property is changed.
public virtual List<IPropertyNullabilityChangedConvention> PropertyNullabilityChangedConventions { get; }
Property Value
PropertyRemovedConventions
Conventions to run when a property is removed.
public virtual List<IPropertyRemovedConvention> PropertyRemovedConventions { get; }
Property Value
SkipNavigationAddedConventions
Conventions to run when a skip navigation property is added.
public virtual List<ISkipNavigationAddedConvention> SkipNavigationAddedConventions { get; }
Property Value
SkipNavigationAnnotationChangedConventions
Conventions to run when an annotation is changed on a skip navigation property.
public virtual List<ISkipNavigationAnnotationChangedConvention> SkipNavigationAnnotationChangedConventions { get; }
Property Value
SkipNavigationForeignKeyChangedConventions
Conventions to run when a skip navigation foreign key is changed.
public virtual List<ISkipNavigationForeignKeyChangedConvention> SkipNavigationForeignKeyChangedConventions { get; }
Property Value
SkipNavigationInverseChangedConventions
Conventions to run when a skip navigation inverse is changed.
public virtual List<ISkipNavigationInverseChangedConvention> SkipNavigationInverseChangedConventions { get; }
Property Value
SkipNavigationRemovedConventions
Conventions to run when a skip navigation property is removed.
public virtual List<ISkipNavigationRemovedConvention> SkipNavigationRemovedConventions { get; }
Property Value
TriggerAddedConventions
Conventions to run when a trigger property is added.
public virtual List<ITriggerAddedConvention> TriggerAddedConventions { get; }
Property Value
TriggerRemovedConventions
Conventions to run when a trigger property is removed.
public virtual List<ITriggerRemovedConvention> TriggerRemovedConventions { get; }
Property Value
TypeIgnoredConventions
Conventions to run when a type is ignored.
public virtual List<ITypeIgnoredConvention> TypeIgnoredConventions { get; }
Property Value
Methods
Add(IConvention)
Adds a convention to the set.
public virtual void Add(IConvention convention)
Parameters
convention
IConventionThe convention to add.
AddAfter<TConvention>(List<TConvention>, TConvention, Type)
Adds a convention after an existing convention.
public static bool AddAfter<TConvention>(List<TConvention> conventionsList, TConvention newConvention, Type existingConventionType)
Parameters
conventionsList
List<TConvention>The list of existing convention instances to scan.
newConvention
TConventionThe new convention.
existingConventionType
TypeThe type of the existing convention.
Returns
Type Parameters
TConvention
The type of convention being added.
AddBefore<TConvention>(List<TConvention>, TConvention, Type)
Adds a convention before an existing convention.
public static bool AddBefore<TConvention>(List<TConvention> conventionsList, TConvention newConvention, Type existingConventionType)
Parameters
conventionsList
List<TConvention>The list of existing convention instances to scan.
newConvention
TConventionThe new convention.
existingConventionType
TypeThe type of the existing convention.
Returns
Type Parameters
TConvention
The type of convention being added.
CreateConventionSet(DbContext)
Call this method to build a ConventionSet for only core services when using the ModelBuilder outside of OnModelCreating(ModelBuilder).
Note that it is unusual to use this method. Consider using DbContext in the normal way instead.
public static ConventionSet CreateConventionSet(DbContext context)
Parameters
context
DbContext
Returns
- ConventionSet
The convention set.
Remove(Type)
Removes the convention of the given type.
public virtual void Remove(Type conventionType)
Parameters
conventionType
TypeThe convention type to remove.
Remove<TConvention>(List<TConvention>, Type)
Removes an existing convention.
public static bool Remove<TConvention>(List<TConvention> conventionsList, Type existingConventionType)
Parameters
conventionsList
List<TConvention>The list of existing convention instances to scan.
existingConventionType
TypeThe type of the existing convention.
Returns
Type Parameters
TConvention
The type of convention being removed.
Replace<TImplementation>(TImplementation)
Replaces an existing convention with a derived convention. Also registers the new convention for any convention types not implemented by the existing convention.
public virtual void Replace<TImplementation>(TImplementation newConvention) where TImplementation : IConvention
Parameters
newConvention
TImplementationThe new convention.
Type Parameters
TImplementation
The type of the old convention.
Replace<TConvention, TImplementation>(List<TConvention>, TImplementation)
Replaces an existing convention with a derived convention.
public static bool Replace<TConvention, TImplementation>(List<TConvention> conventionsList, TImplementation newConvention) where TImplementation : TConvention
Parameters
conventionsList
List<TConvention>The list of existing convention instances to scan.
newConvention
TImplementationThe new convention.
Returns
Type Parameters
TConvention
The type of convention being replaced.
TImplementation
The type of the old convention.