/// <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);
        }
 private static string GetTableNameFromAttribute(TableAttribute tableAttribute, ISqlNameEscaper nameEscaper)
 {
     return(string.IsNullOrEmpty(tableAttribute.Schema)
         ? nameEscaper.EscapeTableName(tableAttribute.Name)
         : nameEscaper.EscapeTableName(tableAttribute.Schema, tableAttribute.Name));
 }
 public AtttributeTableNameConvention(ISqlNameEscaper nameEscaper, string suffix = DefaultSuffix)
 {
     this.NameEscaper = nameEscaper;
     this.suffix      = suffix;
 }
Exemple #5
0
 public PostgresAttributeColumnNameConvention(ISqlNameEscaper nameEscaper)
     : base(nameEscaper)
 {
 }
 public AttributeColumnNameConvention(ISqlNameEscaper nameEscaper)
 {
     this.NameEscaper = nameEscaper;
 }
 public PostgresAttributeTableNameConvention(ISqlNameEscaper nameEscaper, string suffix = DefaultSuffix)
     : base(nameEscaper, suffix)
 {
 }