/// <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)
        {
            ValueGeneratorConvention valueGeneratorConvention = new RelationalValueGeneratorConvention();

            ReplaceConvention(conventionSet.BaseEntityTypeChangedConventions, valueGeneratorConvention);
            ReplaceConvention(conventionSet.PrimaryKeyChangedConventions, valueGeneratorConvention);
            ReplaceConvention(conventionSet.ForeignKeyAddedConventions, valueGeneratorConvention);
            ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, valueGeneratorConvention);

            var relationalColumnAttributeConvention = new RelationalColumnAttributeConvention();

            conventionSet.PropertyAddedConventions.Add(relationalColumnAttributeConvention);

            var sharedTableConvention = new SharedTableConvention();

            conventionSet.EntityTypeAddedConventions.Add(new RelationalTableAttributeConvention());
            conventionSet.EntityTypeAddedConventions.Add(sharedTableConvention);
            conventionSet.BaseEntityTypeChangedConventions.Add(new DiscriminatorConvention());
            conventionSet.BaseEntityTypeChangedConventions.Add(
                new TableNameFromDbSetConvention(Dependencies.Context?.Context, Dependencies.SetFinder));
            conventionSet.EntityTypeAnnotationChangedConventions.Add(sharedTableConvention);
            conventionSet.PropertyFieldChangedConventions.Add(relationalColumnAttributeConvention);
            conventionSet.PropertyAnnotationChangedConventions.Add((RelationalValueGeneratorConvention)valueGeneratorConvention);
            conventionSet.ForeignKeyUniquenessChangedConventions.Add(sharedTableConvention);
            conventionSet.ForeignKeyOwnershipChangedConventions.Add(sharedTableConvention);

            conventionSet.ModelBuiltConventions.Add(new RelationalTypeMappingConvention(Dependencies.TypeMappingSource));
            conventionSet.ModelBuiltConventions.Add(sharedTableConvention);

            conventionSet.ModelAnnotationChangedConventions.Add(new RelationalDbFunctionConvention());

            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);

            ValueGeneratorConvention valueGeneratorConvention = new RelationalValueGeneratorConvention(Dependencies.AnnotationProvider);

            ReplaceConvention(conventionSet.BaseEntityTypeSetConventions, inversePropertyAttributeConvention);
            ReplaceConvention(conventionSet.BaseEntityTypeSetConventions, relationshipDiscoveryConvention);
            ReplaceConvention(conventionSet.BaseEntityTypeSetConventions, valueGeneratorConvention);

            ReplaceConvention(conventionSet.EntityTypeMemberIgnoredConventions, inversePropertyAttributeConvention);
            ReplaceConvention(conventionSet.EntityTypeMemberIgnoredConventions, relationshipDiscoveryConvention);

            ReplaceConvention(conventionSet.PrimaryKeySetConventions, valueGeneratorConvention);

            ReplaceConvention(conventionSet.ForeignKeyAddedConventions,
                              (ForeignKeyAttributeConvention) new RelationalForeignKeyAttributeConvention(typeMapper));
            ReplaceConvention(conventionSet.ForeignKeyAddedConventions, valueGeneratorConvention);

            ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, valueGeneratorConvention);

            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);

            conventionSet.PropertyAnnotationSetConventions.Add((RelationalValueGeneratorConvention)valueGeneratorConvention);

            return(conventionSet);
        }