/// <summary>
        /// Initializes a new instance of the <see cref="TableSchemaFactory"/> class.
        /// </summary>
        public TableSchemaFactory(
            ISqlNameEscaper nameEscaper,
            ITableNameConvention tableNameConvention,
            IColumnNameConvention columnNameConvention,
            IDictionary <Type, DbType> typeMapping)
        {
            Ensure.NotNull(nameEscaper, nameof(nameEscaper));
            Ensure.NotNull(tableNameConvention, nameof(tableNameConvention));
            Ensure.NotNull(columnNameConvention, nameof(columnNameConvention));

            this.nameEscaper          = nameEscaper;
            this.tableNameConvention  = tableNameConvention;
            this.columnNameConvention = columnNameConvention;
            this.typeMapping          = typeMapping;
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PeregrineConfig"/> class.
        /// </summary>
        public PeregrineConfig(
            IDialect dialect,
            ISqlNameEscaper sqlNameEscaper,
            ITableNameConvention tableNameConvention,
            IColumnNameConvention columnNameConvention,
            bool verifyAffectedRowCount,
            ImmutableDictionary <Type, DbType> sqlTypeMappings)
        {
            this.Dialect                = dialect ?? throw new ArgumentNullException(nameof(dialect));
            this.TableNameConvention    = tableNameConvention ?? throw new ArgumentNullException(nameof(tableNameConvention));
            this.ColumnNameConvention   = columnNameConvention ?? throw new ArgumentNullException(nameof(columnNameConvention));
            this.VerifyAffectedRowCount = verifyAffectedRowCount;
            this.SqlTypeMappings        = sqlTypeMappings ?? throw new ArgumentNullException(nameof(sqlTypeMappings));
            this.sqlNameEscaper         = sqlNameEscaper ?? throw new ArgumentNullException(nameof(sqlNameEscaper));

            this.SchemaFactory = new TableSchemaFactory(this.sqlNameEscaper, this.TableNameConvention, this.ColumnNameConvention, this.SqlTypeMappings);
        }
Exemple #3
0
 public PeregrineConfig WithColumnNameConvention(IColumnNameConvention convention)
 {
     return(new PeregrineConfig(this.Dialect, this.sqlNameEscaper, this.TableNameConvention, convention, this.VerifyAffectedRowCount, this.SqlTypeMappings));
 }