/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public virtual ConventionSet AddConventions(ConventionSet conventionSet) { RelationshipDiscoveryConvention relationshipDiscoveryConvention = new RelationalRelationshipDiscoveryConvention(_typeMapper); ReplaceConvention(conventionSet.EntityTypeAddedConventions, (PropertyDiscoveryConvention) new RelationalPropertyDiscoveryConvention(_typeMapper)); ReplaceConvention(conventionSet.EntityTypeAddedConventions, (InversePropertyAttributeConvention) new RelationalInversePropertyAttributeConvention(_typeMapper)); ReplaceConvention(conventionSet.EntityTypeAddedConventions, relationshipDiscoveryConvention); ReplaceConvention(conventionSet.BaseEntityTypeSetConventions, relationshipDiscoveryConvention); ReplaceConvention(conventionSet.EntityTypeMemberIgnoredConventions, relationshipDiscoveryConvention); ReplaceConvention(conventionSet.ForeignKeyAddedConventions, (ForeignKeyAttributeConvention) new RelationalForeignKeyAttributeConvention(_typeMapper)); ReplaceConvention(conventionSet.NavigationAddedConventions, relationshipDiscoveryConvention); ReplaceConvention(conventionSet.NavigationRemovedConventions, relationshipDiscoveryConvention); ReplaceConvention(conventionSet.ModelBuiltConventions, (PropertyMappingValidationConvention) new RelationalPropertyMappingValidationConvention(_typeMapper)); conventionSet.PropertyAddedConventions.Add(new RelationalColumnAttributeConvention()); conventionSet.EntityTypeAddedConventions.Add(new RelationalTableAttributeConvention()); conventionSet.BaseEntityTypeSetConventions.Add(new DiscriminatorConvention()); conventionSet.BaseEntityTypeSetConventions.Add(new TableNameFromDbSetConvention(_context, _setFinder)); return(conventionSet); }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public virtual ConventionSet AddConventions(ConventionSet conventionSet) { var typeMapper = Dependencies.TypeMapper; RelationshipDiscoveryConvention relationshipDiscoveryConvention = new RelationalRelationshipDiscoveryConvention(typeMapper); InversePropertyAttributeConvention inversePropertyAttributeConvention = new RelationalInversePropertyAttributeConvention(typeMapper); ReplaceConvention( conventionSet.EntityTypeAddedConventions, (PropertyDiscoveryConvention) new RelationalPropertyDiscoveryConvention(typeMapper)); ReplaceConvention(conventionSet.EntityTypeAddedConventions, inversePropertyAttributeConvention); ReplaceConvention(conventionSet.EntityTypeAddedConventions, relationshipDiscoveryConvention); ReplaceConvention(conventionSet.EntityTypeIgnoredConventions, inversePropertyAttributeConvention); ReplaceConvention(conventionSet.BaseEntityTypeSetConventions, inversePropertyAttributeConvention); ReplaceConvention(conventionSet.BaseEntityTypeSetConventions, relationshipDiscoveryConvention); ReplaceConvention(conventionSet.EntityTypeMemberIgnoredConventions, inversePropertyAttributeConvention); ReplaceConvention(conventionSet.EntityTypeMemberIgnoredConventions, relationshipDiscoveryConvention); ReplaceConvention( conventionSet.ForeignKeyAddedConventions, (ForeignKeyAttributeConvention) new RelationalForeignKeyAttributeConvention(typeMapper)); ReplaceConvention(conventionSet.NavigationAddedConventions, inversePropertyAttributeConvention); ReplaceConvention(conventionSet.NavigationAddedConventions, relationshipDiscoveryConvention); ReplaceConvention(conventionSet.NavigationRemovedConventions, relationshipDiscoveryConvention); ReplaceConvention( conventionSet.ModelBuiltConventions, (PropertyMappingValidationConvention) new RelationalPropertyMappingValidationConvention(typeMapper)); var relationalColumnAttributeConvention = new RelationalColumnAttributeConvention(); conventionSet.PropertyAddedConventions.Add(relationalColumnAttributeConvention); conventionSet.EntityTypeAddedConventions.Add(new RelationalTableAttributeConvention()); conventionSet.BaseEntityTypeSetConventions.Add(new DiscriminatorConvention()); conventionSet.BaseEntityTypeSetConventions.Add( new TableNameFromDbSetConvention(Dependencies.Context?.Context, Dependencies.SetFinder)); conventionSet.PropertyFieldChangedConventions.Add(relationalColumnAttributeConvention); return(conventionSet); }