/// <summary> /// Init type Sql provider /// </summary> private void InitConfig(SqlGeneratorConfig sqlGeneratorConfig) { Config = sqlGeneratorConfig; if (Config.UseQuotationMarks) { switch (Config.SqlConnector) { case ESqlConnector.MSSQL: TableName = GetTableNameWithSchemaPrefix(TableName, TableSchema, "[", "]"); foreach (var propertyMetadata in SqlProperties) { propertyMetadata.ColumnName = "[" + propertyMetadata.ColumnName + "]"; } foreach (var propertyMetadata in KeySqlProperties) { propertyMetadata.ColumnName = "[" + propertyMetadata.ColumnName + "]"; } foreach (var propertyMetadata in SqlJoinProperties) { propertyMetadata.TableName = GetTableNameWithSchemaPrefix(propertyMetadata.TableName, propertyMetadata.TableSchema, "[", "]"); propertyMetadata.ColumnName = "[" + propertyMetadata.ColumnName + "]"; } if (IdentitySqlProperty != null) { IdentitySqlProperty.ColumnName = "[" + IdentitySqlProperty.ColumnName + "]"; } break; case ESqlConnector.MySQL: TableName = GetTableNameWithSchemaPrefix(TableName, TableSchema, "`", "`"); foreach (var propertyMetadata in SqlProperties) { propertyMetadata.ColumnName = "`" + propertyMetadata.ColumnName + "`"; } foreach (var propertyMetadata in KeySqlProperties) { propertyMetadata.ColumnName = "`" + propertyMetadata.ColumnName + "`"; } foreach (var propertyMetadata in SqlJoinProperties) { propertyMetadata.TableName = GetTableNameWithSchemaPrefix(propertyMetadata.TableName, propertyMetadata.TableSchema, "`", "`"); propertyMetadata.ColumnName = "`" + propertyMetadata.ColumnName + "`"; } if (IdentitySqlProperty != null) { IdentitySqlProperty.ColumnName = "`" + IdentitySqlProperty.ColumnName + "`"; } break; case ESqlConnector.PostgreSQL: TableName = GetTableNameWithSchemaPrefix(TableName, TableSchema, "\"", "\""); foreach (var propertyMetadata in SqlProperties) { propertyMetadata.ColumnName = "\"" + propertyMetadata.ColumnName + "\""; } foreach (var propertyMetadata in KeySqlProperties) { propertyMetadata.ColumnName = "\"" + propertyMetadata.ColumnName + "\""; } foreach (var propertyMetadata in SqlJoinProperties) { propertyMetadata.TableName = GetTableNameWithSchemaPrefix(propertyMetadata.TableName, propertyMetadata.TableSchema, "\"", "\""); propertyMetadata.ColumnName = "\"" + propertyMetadata.ColumnName + "\""; } if (IdentitySqlProperty != null) { IdentitySqlProperty.ColumnName = "\"" + IdentitySqlProperty.ColumnName + "\""; } break; default: throw new ArgumentOutOfRangeException(nameof(Config.SqlConnector)); } } else { TableName = GetTableNameWithSchemaPrefix(TableName, TableSchema); foreach (var propertyMetadata in SqlJoinProperties) { propertyMetadata.TableName = GetTableNameWithSchemaPrefix(propertyMetadata.TableName, propertyMetadata.TableSchema); } } }