/// <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 static IConfiguration SetTableNameConvention(this IConfiguration configuration, ITableNameConvention convention)
 {
     configuration.TableNameConvention = convention;
     return(configuration);
 }
 public CreateDocumentCommand(Document document, ITableNameConvention tableNameConvention, string tablePrefix, string collection) : base(document, collection)
 {
     _tableNameConvention = tableNameConvention;
     _tablePrefix         = tablePrefix;
 }
 public CreateDocumentCommand(IEnumerable <Document> documents, ITableNameConvention tableNameConvention, string tablePrefix, string collection) : base(documents, collection)
 {
     _tableNameConvention = tableNameConvention;
     _tablePrefix         = tablePrefix;
 }
Exemple #6
0
 public PeregrineConfig WithTableNameConvention(ITableNameConvention convention)
 {
     return(new PeregrineConfig(this.Dialect, this.sqlNameEscaper, convention, this.ColumnNameConvention, this.VerifyAffectedRowCount, this.SqlTypeMappings));
 }