File tree Expand file tree Collapse file tree 7 files changed +220
-210
lines changed Expand file tree Collapse file tree 7 files changed +220
-210
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ namespace ChinookDatabase.Test.DatabaseTests
251251 foreach (DataColumn col in table.Columns)
252252 {
253253 string expected = DataSetHelper.GetExpectedValue(col, table.Rows[num][col.ColumnName].ToString());
254- #> Assert.Equal(<#= expected #>, row["<#= col.ColumnName #>"].ToString());
254+ #> Assert.Equal(<#= expected #>, row["<#= option.Strategy.FormatCase( col.ColumnName) #>"].ToString());
255255<#
256256 } // foreach column
257257#> }
@@ -286,7 +286,7 @@ namespace ChinookDatabase.Test.DatabaseTests
286286 foreach (DataColumn col in ds.Tables["Customer"].Columns)
287287 {
288288 string expected = DataSetHelper.GetExpectedValue(col, ds.Tables["Customer"].Rows[i][col.ColumnName].ToString());
289- #> Assert.Equal(<#= expected #>, row["<#= col.ColumnName #>"].ToString());
289+ #> Assert.Equal(<#= expected #>, row["<#= option.Strategy.FormatCase( col.ColumnName) #>"].ToString());
290290<#
291291 }
292292#>
Original file line number Diff line number Diff line change 44 "Chinook_MySql" : " Server=localhost;Database=Chinook;Uid=chinook;Pwd=chinook;" ,
55 "Chinook_MySql_AutoIncrement" : " Server=localhost;Database=Chinook_AutoIncrement;Uid=chinook;Pwd=chinook;" ,
66 "Chinook_Oracle" : " Data Source=localhost:1521/XEPDB1;User Id=c##chinook;Password=chinook;" ,
7- "Chinook_PostgreSql" : " Server=localhost;Database=Chinook ;User Id=chinook;Password=chinook;" ,
7+ "Chinook_PostgreSql" : " Server=localhost;Database=chinook ;User Id=chinook;Password=chinook;" ,
88 "Chinook_Sqlite" : " Data Source=..\\ ..\\ ..\\ ChinookDatabase\\ DataSources\\ Chinook_Sqlite.sqlite" ,
99 "Chinook_Sqlite_AutoIncrement" : " Data Source=..\\ ..\\ ..\\ ChinookDatabase\\ DataSources\\ Chinook_Sqlite_AutoIncrementPKs.sqlite" ,
1010 "Chinook_SqlServer" : " Data Source=localhost\\ SQLEXPRESS;Initial Catalog=Chinook;Integrated Security=SSPI;Persist Security Info=False;" ,
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ protected AbstractDdlStrategy()
3636
3737 public virtual string FormatName ( string name ) => $ "[{ name } ]";
3838
39+ public virtual string FormatCase ( string text ) => text ;
40+
3941 public virtual string FormatPrimaryKey ( string name ) => FormatName ( $ "PK_{ name } ") ;
4042
4143 public virtual string FormatForeignKey ( string table , string column ) => FormatName ( $ "FK_{ table } { column } ") ;
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ public interface IDdlStrategy
2929 #region Methods used to build SQL commands.
3030
3131 string FormatName ( string name ) ;
32+ string FormatCase ( string text ) ;
3233 string FormatPrimaryKey ( string name ) ;
3334 string FormatForeignKey ( string table , string column ) ;
3435 string FormatForeignKeyIndex ( string table , string column ) ;
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ public PostgreSqlStrategy()
2525
2626 public override string FormatName ( string name ) => ToSnakeCase ( name ) ;
2727
28+ public override string FormatCase ( string text ) => ToSnakeCase ( text ) ;
29+
2830 public override string FormatPrimaryKey ( string name ) => $ "{ ToSnakeCase ( name ) } _pkey";
2931
3032 public override string FormatForeignKey ( string table , string column ) => $ "{ ToSnakeCase ( table ) } _{ ToSnakeCase ( column ) } _fkey";
Original file line number Diff line number Diff line change 62876287
62886288 public virtual string FormatName(string name) => $"[{name}]";
62896289
6290+ public virtual string FormatCase(string text) => text;
6291+
62906292 public virtual string FormatPrimaryKey(string name) => FormatName($"PK_{name}");
62916293
62926294 public virtual string FormatForeignKey(string table, string column) => FormatName($"FK_{table}{column}");
64346436 #region Methods used to build SQL commands.
64356437
64366438 string FormatName(string name);
6439+ string FormatCase(string text);
64376440 string FormatPrimaryKey(string name);
64386441 string FormatForeignKey(string table, string column);
64396442 string FormatForeignKeyIndex(string table, string column);
66146617
66156618 public override string FormatName(string name) => ToSnakeCase(name);
66166619
6620+ public override string FormatCase(string text) => ToSnakeCase(text);
6621+
66176622 public override string FormatPrimaryKey(string name) => $"{ToSnakeCase(name)}_pkey";
66186623
66196624 public override string FormatForeignKey(string table, string column) => $"{ToSnakeCase(table)}_{ToSnakeCase(column)}_fkey";
You can’t perform that action at this time.
0 commit comments