Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

NopConventionSet.cs

using FluentMigrator.Runner;
using FluentMigrator.Runner.Conventions;

namespace Nop.Data.Migrations;

/// 
/// A set conventions to be applied to expressions
/// 
public class NopConventionSet : IConventionSet
{
    #region Ctor

    public NopConventionSet(INopDataProvider dataProvider)
    {
        ArgumentNullException.ThrowIfNull(dataProvider);

        var defaultConventionSet = new DefaultConventionSet();

        ForeignKeyConventions = new List()
        {
            new NopForeignKeyConvention(dataProvider),
            defaultConventionSet.SchemaConvention,
        };

        IndexConventions = new List()
        {
            new NopIndexConvention(dataProvider),
            defaultConventionSet.SchemaConvention
        };

        ColumnsConventions = new List()
        {
            new NopColumnsConvention(),
            new DefaultPrimaryKeyNameConvention()
        };

        ConstraintConventions = defaultConventionSet.ConstraintConventions;

        SequenceConventions = defaultConventionSet.SequenceConventions;
        AutoNameConventions = defaultConventionSet.AutoNameConventions;
        SchemaConvention = defaultConventionSet.SchemaConvention;
        RootPathConvention = defaultConventionSet.RootPathConvention;
    }

    #endregion

    #region Properties

    /// 
    /// Gets the root path convention to be applied to  implementations
    /// 
    public IRootPathConvention RootPathConvention { get; }

    /// 
    /// Gets the default schema name convention to be applied to  implementations
    /// 
    /// 
    /// This class cannot be overridden. The 
    /// must be implemented/provided instead.
    /// 
    public DefaultSchemaConvention SchemaConvention { get; }

    /// 
    /// Gets the conventions to be applied to  implementations
    /// 
    public IList ColumnsConventions { get; }

    /// 
    /// Gets the conventions to be applied to  implementations
    /// 
    public IList ConstraintConventions { get; }

    /// 
    /// Gets the conventions to be applied to  implementations
    /// 
    public IList ForeignKeyConventions { get; }

    /// 
    /// Gets the conventions to be applied to  implementations
    /// 
    public IList IndexConventions { get; }

    /// 
    /// Gets the conventions to be applied to  implementations
    /// 
    public IList SequenceConventions { get; }

    /// 
    /// Gets the conventions to be applied to  implementations
    /// 
    public IList AutoNameConventions { get; }

    #endregion
}