- 增加 FreeSqlBuilder UseNameConvert 方法,类名、属性名都生效;

- 调整 FreeSqlBuilder,准备移除 UseEntityPropertyNameConvert/UseSyncStructureToLower/UseSyncStructureToUpper 方法;#260
This commit is contained in:
28810
2020-03-31 07:02:42 +08:00
parent bbe5450eb9
commit f3593a321f
25 changed files with 232 additions and 95 deletions

View File

@ -44,7 +44,7 @@ public class g
static Lazy<IFreeSql> pgsqlLazy = new Lazy<IFreeSql>(() => new FreeSql.FreeSqlBuilder()
.UseConnectionString(FreeSql.DataType.PostgreSQL, "Host=192.168.164.10;Port=5432;Username=postgres;Password=123456;Database=tedb;Pooling=true;Maximum Pool Size=10")
.UseAutoSyncStructure(true)
.UseSyncStructureToLower(true)
.UseNameConvert(FreeSql.Internal.NameConvertType.ToLower)
.UseLazyLoading(true)
.UseMonitorCommand(
cmd =>
@ -63,7 +63,7 @@ public class g
.UseConnectionString(FreeSql.DataType.Oracle, "user id=user1;password=123456;data source=//127.0.0.1:1521/XE;Pooling=true;Max Pool Size=10")
.UseAutoSyncStructure(true)
.UseLazyLoading(true)
.UseSyncStructureToUpper(true)
.UseNameConvert(FreeSql.Internal.NameConvertType.ToUpper)
.UseNoneCommandParameter(true)
.UseMonitorCommand(

View File

@ -270,7 +270,7 @@ namespace FreeSql.Tests.MySqlConnector
})
});
var ddd = g.mysql.Select<District>().LeftJoin(d => d.ParentCode == d.Parent.Code).ToTreeList();
Assert.Equal(1, ddd.Count);
Assert.Single(ddd);
Assert.Equal(2, ddd[0].Childs.Count);
}
public class District

View File

@ -21,10 +21,10 @@ namespace FreeSql.Tests.MySqlConnector
{
g.mysql.Delete<TestOnDuplicateKeyUpdateInfo>(new[] { 100, 101, 102 }).ExecuteAffrows();
var odku1 = g.mysql.Insert(new TestOnDuplicateKeyUpdateInfo { id = 100, title = "title-100", time = DateTime.Parse("2000-01-01") }).NoneParameter().OnDuplicateKeyUpdate();
Assert.Equal(odku1.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(100, 'title-100', '2000-01-01 00:00:00.000')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(100, 'title-100', '2000-01-01 00:00:00.000')
ON DUPLICATE KEY UPDATE
`title` = VALUES(`title`),
`time` = VALUES(`time`)");
`time` = VALUES(`time`)", odku1.ToSql());
Assert.Equal(1, odku1.ExecuteAffrows());
var odku2 = g.mysql.Insert(new[] {
@ -32,10 +32,10 @@ ON DUPLICATE KEY UPDATE
new TestOnDuplicateKeyUpdateInfo { id = 101, title = "title-101", time = DateTime.Parse("2000-01-01") },
new TestOnDuplicateKeyUpdateInfo { id = 102, title = "title-102", time = DateTime.Parse("2000-01-01") }
}).NoneParameter().OnDuplicateKeyUpdate();
Assert.Equal(odku2.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(100, 'title-100', '2000-01-01 00:00:00.000'), (101, 'title-101', '2000-01-01 00:00:00.000'), (102, 'title-102', '2000-01-01 00:00:00.000')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(100, 'title-100', '2000-01-01 00:00:00.000'), (101, 'title-101', '2000-01-01 00:00:00.000'), (102, 'title-102', '2000-01-01 00:00:00.000')
ON DUPLICATE KEY UPDATE
`title` = VALUES(`title`),
`time` = VALUES(`time`)");
`time` = VALUES(`time`)", odku2.ToSql());
odku2.ExecuteAffrows();
}
@ -44,10 +44,10 @@ ON DUPLICATE KEY UPDATE
{
g.mysql.Delete<TestOnDuplicateKeyUpdateInfo>(new[] { 200, 201, 202 }).ExecuteAffrows();
var odku1 = g.mysql.Insert(new TestOnDuplicateKeyUpdateInfo { id = 200, title = "title-200", time = DateTime.Parse("2000-01-01") }).IgnoreColumns(a => a.time).NoneParameter().OnDuplicateKeyUpdate();
Assert.Equal(odku1.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(200, 'title-200')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(200, 'title-200')
ON DUPLICATE KEY UPDATE
`title` = VALUES(`title`),
`time` = '2000-01-01 00:00:00.000'");
`time` = '2000-01-01 00:00:00.000'", odku1.ToSql());
Assert.Equal(1, odku1.ExecuteAffrows());
var odku2 = g.mysql.Insert(new[] {
@ -55,21 +55,21 @@ ON DUPLICATE KEY UPDATE
new TestOnDuplicateKeyUpdateInfo { id = 201, title = "title-201", time = DateTime.Parse("2000-01-01") },
new TestOnDuplicateKeyUpdateInfo { id = 202, title = "title-202", time = DateTime.Parse("2000-01-01") }
}).IgnoreColumns(a => a.time).NoneParameter().OnDuplicateKeyUpdate();
Assert.Equal(odku2.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(200, 'title-200'), (201, 'title-201'), (202, 'title-202')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(200, 'title-200'), (201, 'title-201'), (202, 'title-202')
ON DUPLICATE KEY UPDATE
`title` = VALUES(`title`),
`time` = CASE `id`
WHEN 200 THEN '2000-01-01 00:00:00.000'
WHEN 201 THEN '2000-01-01 00:00:00.000'
WHEN 202 THEN '2000-01-01 00:00:00.000' END");
WHEN 202 THEN '2000-01-01 00:00:00.000' END", odku2.ToSql());
odku2.ExecuteAffrows();
g.mysql.Delete<TestOnDuplicateKeyUpdateInfo>(new[] { 200, 201, 202 }).ExecuteAffrows();
odku1 = g.mysql.Insert(new TestOnDuplicateKeyUpdateInfo { id = 200, title = "title-200", time = DateTime.Parse("2000-01-01") }).IgnoreColumns(a => a.time).NoneParameter().OnDuplicateKeyUpdate().IgnoreColumns(a => a.title);
Assert.Equal(odku1.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(200, 'title-200')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(200, 'title-200')
ON DUPLICATE KEY UPDATE
`time` = '2000-01-01 00:00:00.000'");
`time` = '2000-01-01 00:00:00.000'", odku1.ToSql());
Assert.Equal(1, odku1.ExecuteAffrows());
odku2 = g.mysql.Insert(new[] {
@ -77,12 +77,12 @@ ON DUPLICATE KEY UPDATE
new TestOnDuplicateKeyUpdateInfo { id = 201, title = "title-201", time = DateTime.Parse("2000-01-01") },
new TestOnDuplicateKeyUpdateInfo { id = 202, title = "title-202", time = DateTime.Parse("2000-01-01") }
}).IgnoreColumns(a => a.time).NoneParameter().OnDuplicateKeyUpdate().IgnoreColumns(a => a.title);
Assert.Equal(odku2.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(200, 'title-200'), (201, 'title-201'), (202, 'title-202')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(200, 'title-200'), (201, 'title-201'), (202, 'title-202')
ON DUPLICATE KEY UPDATE
`time` = CASE `id`
WHEN 200 THEN '2000-01-01 00:00:00.000'
WHEN 201 THEN '2000-01-01 00:00:00.000'
WHEN 202 THEN '2000-01-01 00:00:00.000' END");
WHEN 202 THEN '2000-01-01 00:00:00.000' END", odku2.ToSql());
odku2.ExecuteAffrows();
}
@ -91,10 +91,10 @@ WHEN 202 THEN '2000-01-01 00:00:00.000' END");
{
g.mysql.Delete<TestOnDuplicateKeyUpdateInfo>(new[] { 300, 301, 302 }).ExecuteAffrows();
var odku1 = g.mysql.Insert(new TestOnDuplicateKeyUpdateInfo { id = 300, title = "title-300", time = DateTime.Parse("2000-01-01") }).InsertColumns(a => a.title).NoneParameter().OnDuplicateKeyUpdate();
Assert.Equal(odku1.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(300, 'title-300')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(300, 'title-300')
ON DUPLICATE KEY UPDATE
`title` = VALUES(`title`),
`time` = '2000-01-01 00:00:00.000'");
`time` = '2000-01-01 00:00:00.000'", odku1.ToSql());
Assert.Equal(1, odku1.ExecuteAffrows());
var odku2 = g.mysql.Insert(new[] {
@ -102,21 +102,21 @@ ON DUPLICATE KEY UPDATE
new TestOnDuplicateKeyUpdateInfo { id = 301, title = "title-301", time = DateTime.Parse("2000-01-01") },
new TestOnDuplicateKeyUpdateInfo { id = 302, title = "title-302", time = DateTime.Parse("2000-01-01") }
}).InsertColumns(a => a.title).NoneParameter().OnDuplicateKeyUpdate();
Assert.Equal(odku2.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(300, 'title-300'), (301, 'title-301'), (302, 'title-302')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(300, 'title-300'), (301, 'title-301'), (302, 'title-302')
ON DUPLICATE KEY UPDATE
`title` = VALUES(`title`),
`time` = CASE `id`
WHEN 300 THEN '2000-01-01 00:00:00.000'
WHEN 301 THEN '2000-01-01 00:00:00.000'
WHEN 302 THEN '2000-01-01 00:00:00.000' END");
WHEN 302 THEN '2000-01-01 00:00:00.000' END", odku2.ToSql());
odku2.ExecuteAffrows();
g.mysql.Delete<TestOnDuplicateKeyUpdateInfo>(new[] { 300, 301, 302 }).ExecuteAffrows();
odku1 = g.mysql.Insert(new TestOnDuplicateKeyUpdateInfo { id = 300, title = "title-300", time = DateTime.Parse("2000-01-01") }).InsertColumns(a => a.title).NoneParameter().OnDuplicateKeyUpdate().UpdateColumns(a => a.time);
Assert.Equal(odku1.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(300, 'title-300')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(300, 'title-300')
ON DUPLICATE KEY UPDATE
`time` = '2000-01-01 00:00:00.000'");
`time` = '2000-01-01 00:00:00.000'", odku1.ToSql());
Assert.Equal(1, odku1.ExecuteAffrows());
odku2 = g.mysql.Insert(new[] {
@ -124,12 +124,12 @@ ON DUPLICATE KEY UPDATE
new TestOnDuplicateKeyUpdateInfo { id = 301, title = "title-301", time = DateTime.Parse("2000-01-01") },
new TestOnDuplicateKeyUpdateInfo { id = 302, title = "title-302", time = DateTime.Parse("2000-01-01") }
}).InsertColumns(a => a.title).NoneParameter().OnDuplicateKeyUpdate().UpdateColumns(a => a.time);
Assert.Equal(odku2.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(300, 'title-300'), (301, 'title-301'), (302, 'title-302')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`) VALUES(300, 'title-300'), (301, 'title-301'), (302, 'title-302')
ON DUPLICATE KEY UPDATE
`time` = CASE `id`
WHEN 300 THEN '2000-01-01 00:00:00.000'
WHEN 301 THEN '2000-01-01 00:00:00.000'
WHEN 302 THEN '2000-01-01 00:00:00.000' END");
WHEN 302 THEN '2000-01-01 00:00:00.000' END", odku2.ToSql());
odku2.ExecuteAffrows();
}
@ -138,9 +138,9 @@ WHEN 302 THEN '2000-01-01 00:00:00.000' END");
{
g.mysql.Delete<TestOnDuplicateKeyUpdateInfo>(new[] { 400, 401, 402 }).ExecuteAffrows();
var odku1 = g.mysql.Insert(new TestOnDuplicateKeyUpdateInfo { id = 400, title = "title-400", time = DateTime.Parse("2000-01-01") }).NoneParameter().OnDuplicateKeyUpdate().Set(a => a.time, DateTime.Parse("2020-1-1"));
Assert.Equal(odku1.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(400, 'title-400', '2000-01-01 00:00:00.000')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(400, 'title-400', '2000-01-01 00:00:00.000')
ON DUPLICATE KEY UPDATE
`time` = '2020-01-01 00:00:00.000'");
`time` = '2020-01-01 00:00:00.000'", odku1.ToSql());
Assert.Equal(1, odku1.ExecuteAffrows());
var odku2 = g.mysql.Insert(new[] {
@ -148,18 +148,18 @@ ON DUPLICATE KEY UPDATE
new TestOnDuplicateKeyUpdateInfo { id = 401, title = "title-401", time = DateTime.Parse("2000-01-01") },
new TestOnDuplicateKeyUpdateInfo { id = 402, title = "title-402", time = DateTime.Parse("2000-01-01") }
}).NoneParameter().OnDuplicateKeyUpdate().Set(a => a.time, DateTime.Parse("2020-1-1"));
Assert.Equal(odku2.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(400, 'title-400', '2000-01-01 00:00:00.000'), (401, 'title-401', '2000-01-01 00:00:00.000'), (402, 'title-402', '2000-01-01 00:00:00.000')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(400, 'title-400', '2000-01-01 00:00:00.000'), (401, 'title-401', '2000-01-01 00:00:00.000'), (402, 'title-402', '2000-01-01 00:00:00.000')
ON DUPLICATE KEY UPDATE
`time` = '2020-01-01 00:00:00.000'");
`time` = '2020-01-01 00:00:00.000'", odku2.ToSql());
odku2.ExecuteAffrows();
var dt2020 = DateTime.Parse("2020-1-1");
g.mysql.Delete<TestOnDuplicateKeyUpdateInfo>(new[] { 400, 401, 402 }).ExecuteAffrows();
odku1 = g.mysql.Insert(new TestOnDuplicateKeyUpdateInfo { id = 400, title = "title-400", time = DateTime.Parse("2000-01-01") }).NoneParameter().OnDuplicateKeyUpdate().Set(a => a.time == dt2020);
Assert.Equal(odku1.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(400, 'title-400', '2000-01-01 00:00:00.000')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(400, 'title-400', '2000-01-01 00:00:00.000')
ON DUPLICATE KEY UPDATE
`time` = '2020-01-01 00:00:00.000'");
`time` = '2020-01-01 00:00:00.000'", odku1.ToSql());
Assert.Equal(1, odku1.ExecuteAffrows());
odku2 = g.mysql.Insert(new[] {
@ -167,17 +167,17 @@ ON DUPLICATE KEY UPDATE
new TestOnDuplicateKeyUpdateInfo { id = 401, title = "title-401", time = DateTime.Parse("2000-01-01") },
new TestOnDuplicateKeyUpdateInfo { id = 402, title = "title-402", time = DateTime.Parse("2000-01-01") }
}).NoneParameter().OnDuplicateKeyUpdate().Set(a => a.time == dt2020);
Assert.Equal(odku2.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(400, 'title-400', '2000-01-01 00:00:00.000'), (401, 'title-401', '2000-01-01 00:00:00.000'), (402, 'title-402', '2000-01-01 00:00:00.000')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(400, 'title-400', '2000-01-01 00:00:00.000'), (401, 'title-401', '2000-01-01 00:00:00.000'), (402, 'title-402', '2000-01-01 00:00:00.000')
ON DUPLICATE KEY UPDATE
`time` = '2020-01-01 00:00:00.000'");
`time` = '2020-01-01 00:00:00.000'", odku2.ToSql());
odku2.ExecuteAffrows();
g.mysql.Delete<TestOnDuplicateKeyUpdateInfo>(new[] { 400, 401, 402 }).ExecuteAffrows();
odku1 = g.mysql.Insert(new TestOnDuplicateKeyUpdateInfo { id = 400, title = "title-400", time = DateTime.Parse("2000-01-01") }).NoneParameter().OnDuplicateKeyUpdate().Set(a => new { time = dt2020, title = a.title + "123" });
Assert.Equal(odku1.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(400, 'title-400', '2000-01-01 00:00:00.000')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(400, 'title-400', '2000-01-01 00:00:00.000')
ON DUPLICATE KEY UPDATE
`time` = '2020-01-01 00:00:00.000', `title` = concat(`title`, '123')");
`time` = '2020-01-01 00:00:00.000', `title` = concat(`title`, '123')", odku1.ToSql());
Assert.Equal(1, odku1.ExecuteAffrows());
odku2 = g.mysql.Insert(new[] {
@ -185,9 +185,9 @@ ON DUPLICATE KEY UPDATE
new TestOnDuplicateKeyUpdateInfo { id = 401, title = "title-401", time = DateTime.Parse("2000-01-01") },
new TestOnDuplicateKeyUpdateInfo { id = 402, title = "title-402", time = DateTime.Parse("2000-01-01") }
}).NoneParameter().OnDuplicateKeyUpdate().Set(a => new { time = dt2020, title = a.title + "123" });
Assert.Equal(odku2.ToSql(), @"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(400, 'title-400', '2000-01-01 00:00:00.000'), (401, 'title-401', '2000-01-01 00:00:00.000'), (402, 'title-402', '2000-01-01 00:00:00.000')
Assert.Equal(@"INSERT INTO `TestOnDuplicateKeyUpdateInfo`(`id`, `title`, `time`) VALUES(400, 'title-400', '2000-01-01 00:00:00.000'), (401, 'title-401', '2000-01-01 00:00:00.000'), (402, 'title-402', '2000-01-01 00:00:00.000')
ON DUPLICATE KEY UPDATE
`time` = '2020-01-01 00:00:00.000', `title` = concat(`title`, '123')");
`time` = '2020-01-01 00:00:00.000', `title` = concat(`title`, '123')", odku2.ToSql());
odku2.ExecuteAffrows();
}

View File

@ -211,7 +211,7 @@ namespace FreeSql.Tests.Odbc.Dameng
})
});
var ddd = g.dameng.Select<District>().LeftJoin(d => d.ParentCode == d.Parent.Code).ToTreeList();
Assert.Equal(1, ddd.Count);
Assert.Single(ddd);
Assert.Equal(2, ddd[0].Childs.Count);
}
public class District

View File

@ -202,7 +202,7 @@ namespace FreeSql.Tests.Odbc.Default
})
});
var ddd = g.odbc.Select<District>().LeftJoin(d => d.ParentCode == d.Parent.Code).ToTreeList();
Assert.Equal(1, ddd.Count);
Assert.Single(ddd);
Assert.Equal(2, ddd[0].Childs.Count);
}
public class District

View File

@ -311,7 +311,7 @@ namespace FreeSql.Tests.Odbc.MySql
})
});
var ddd = g.mysql.Select<District>().LeftJoin(d => d.ParentCode == d.Parent.Code).ToTreeList();
Assert.Equal(1, ddd.Count);
Assert.Single(ddd);
Assert.Equal(2, ddd[0].Childs.Count);
}
public class District

View File

@ -211,7 +211,7 @@ namespace FreeSql.Tests.Odbc.Oracle
})
});
var ddd = g.oracle.Select<District>().LeftJoin(d => d.ParentCode == d.Parent.Code).ToTreeList();
Assert.Equal(1, ddd.Count);
Assert.Single(ddd);
Assert.Equal(2, ddd[0].Childs.Count);
}
public class District

View File

@ -287,7 +287,7 @@ namespace FreeSql.Tests.Odbc.PostgreSQL
})
});
var ddd = g.pgsql.Select<District>().LeftJoin(d => d.ParentCode == d.Parent.Code).ToTreeList();
Assert.Equal(1, ddd.Count);
Assert.Single(ddd);
Assert.Equal(2, ddd[0].Childs.Count);
}
public class District

View File

@ -201,7 +201,7 @@ namespace FreeSql.Tests.Odbc.SqlServer
})
});
var ddd = g.sqlserver.Select<District>().LeftJoin(d => d.ParentCode == d.Parent.Code).ToTreeList();
Assert.Equal(1, ddd.Count);
Assert.Single(ddd);
Assert.Equal(2, ddd[0].Childs.Count);
}
public class District

View File

@ -35,7 +35,7 @@ public class g
//.UseConnectionFactory(FreeSql.DataType.OdbcOracle, () => new System.Data.Odbc.OdbcConnection("Driver={Oracle in XE};Server=//127.0.0.1:1521/XE;Persist Security Info=False;Trusted_Connection=Yes;UID=odbc1;PWD=123456"))
.UseAutoSyncStructure(true)
.UseLazyLoading(true)
.UseSyncStructureToUpper(true)
.UseNameConvert(FreeSql.Internal.NameConvertType.ToUpper)
//.UseNoneCommandParameter(true)
.UseMonitorCommand(
@ -50,7 +50,7 @@ public class g
.UseConnectionString(FreeSql.DataType.OdbcPostgreSQL, "Driver={PostgreSQL Unicode(x64)};Server=192.168.164.10;Port=5432;UID=postgres;PWD=123456;Database=tedb_odbc;Pooling=true;Maximum Pool Size=2")
//.UseConnectionFactory(FreeSql.DataType.OdbcPostgreSQL, () => new System.Data.Odbc.OdbcConnection("Driver={PostgreSQL Unicode(x64)};Server=192.168.164.10;Port=5432;UID=postgres;PWD=123456;Database=tedb_odbc;Pooling=true;"))
.UseAutoSyncStructure(true)
.UseSyncStructureToLower(true)
.UseNameConvert(FreeSql.Internal.NameConvertType.ToLower)
.UseLazyLoading(true)
.UseMonitorCommand(
cmd => Trace.WriteLine(cmd.CommandText), //监听SQL命令对象在执行前
@ -74,7 +74,7 @@ public class g
//.UseConnectionFactory(FreeSql.DataType.OdbcDameng, () => new System.Data.Odbc.OdbcConnection("Driver={DM8 ODBC DRIVER};Server=127.0.0.1:5236;Persist Security Info=False;Trusted_Connection=Yes;UID=USER1;PWD=123456789"))
.UseAutoSyncStructure(true)
.UseLazyLoading(true)
.UseSyncStructureToUpper(true)
.UseNameConvert(FreeSql.Internal.NameConvertType.ToUpper)
//.UseNoneCommandParameter(true)
.UseMonitorCommand(
@ -89,7 +89,7 @@ public class g
//.UseConnectionFactory(FreeSql.DataType.OdbcDameng, () => new System.Data.Odbc.OdbcConnection("Driver={DM8 ODBC DRIVER};Server=127.0.0.1:5236;Persist Security Info=False;Trusted_Connection=Yes;UID=USER1;PWD=123456789"))
.UseAutoSyncStructure(true)
.UseLazyLoading(true)
.UseSyncStructureToUpper(true)
.UseNameConvert(FreeSql.Internal.NameConvertType.ToUpper)
//.UseNoneCommandParameter(true)
.UseMonitorCommand(

View File

@ -202,7 +202,7 @@ namespace FreeSql.Tests.MsAccess
})
});
var ddd = g.msaccess.Select<District>().LeftJoin(d => d.ParentCode == d.Parent.Code).ToTreeList();
Assert.Equal(1, ddd.Count);
Assert.Single(ddd);
Assert.Equal(2, ddd[0].Childs.Count);
}
public class District

View File

@ -311,7 +311,7 @@ namespace FreeSql.Tests.MySql
})
});
var ddd = g.mysql.Select<District>().LeftJoin(d => d.ParentCode == d.Parent.Code).ToTreeList();
Assert.Equal(1, ddd.Count);
Assert.Single(ddd);
Assert.Equal(2, ddd[0].Childs.Count);
}
public class District

View File

@ -211,7 +211,7 @@ namespace FreeSql.Tests.Oracle
})
});
var ddd = g.oracle.Select<District>().LeftJoin(d => d.ParentCode == d.Parent.Code).ToTreeList();
Assert.Equal(1, ddd.Count);
Assert.Single(ddd);
Assert.Equal(2, ddd[0].Childs.Count);
}
public class District

View File

@ -287,7 +287,7 @@ namespace FreeSql.Tests.PostgreSQL
})
});
var ddd = g.pgsql.Select<District>().LeftJoin(d => d.ParentCode == d.Parent.Code).ToTreeList();
Assert.Equal(1, ddd.Count);
Assert.Single(ddd);
Assert.Equal(2, ddd[0].Childs.Count);
}
public class District

View File

@ -211,7 +211,7 @@ namespace FreeSql.Tests.SqlServer
})
});
var ddd = g.sqlserver.Select<District>().LeftJoin(d => d.ParentCode == d.Parent.Code).ToTreeList();
Assert.Equal(1, ddd.Count);
Assert.Single(ddd);
Assert.Equal(2, ddd[0].Childs.Count);
}
public class District

View File

@ -228,7 +228,7 @@ namespace FreeSql.Tests.Sqlite
})
});
var ddd = g.sqlite.Select<District>().LeftJoin(d => d.ParentCode == d.Parent.Code).ToTreeList();
Assert.Equal(1, ddd.Count);
Assert.Single(ddd);
Assert.Equal(2, ddd[0].Childs.Count);
}
public class District

View File

@ -574,7 +574,7 @@ namespace FreeSql.Tests
IFreeSql fsql = new FreeSql.FreeSqlBuilder()
.UseConnectionString(FreeSql.DataType.PostgreSQL, "Host=192.168.164.10;Port=5432;Username=postgres;Password=123456;Database=tedb;Pooling=true;Maximum Pool Size=7")
.UseEntityPropertyNameConvert(Internal.StringConvertType.PascalCaseToUnderscoreWithLower)
.UseNameConvert(Internal.NameConvertType.PascalCaseToUnderscoreWithLower)
.UseNoneCommandParameter(true)
.UseAutoSyncStructure(true) //自动同步实体结构到数据库
.UseMonitorCommand(a => Trace.WriteLine(a.CommandText))

View File

@ -247,7 +247,7 @@ namespace FreeSql.Tests
.UseAutoSyncStructure(true)
.UseGenerateCommandParameterWithLambda(true)
.UseLazyLoading(true)
.UseSyncStructureToUpper(true)
.UseNameConvert(FreeSql.Internal.NameConvertType.ToUpper)
.UseMonitorCommand(cmd => Trace.WriteLine("\r\n线程" + Thread.CurrentThread.ManagedThreadId + ": " + cmd.CommandText))
.Build());
ib.Register("db3", () => new FreeSql.FreeSqlBuilder()

View File

@ -29,7 +29,7 @@ public class g
//.UseConnectionFactory(FreeSql.DataType.PostgreSQL, () => new Npgsql.NpgsqlConnection("Host=192.168.164.10;Port=5432;Username=postgres;Password=123456;Database=tedb;Pooling=true;"))
.UseAutoSyncStructure(true)
//.UseGenerateCommandParameterWithLambda(true)
.UseSyncStructureToLower(true)
.UseNameConvert(FreeSql.Internal.NameConvertType.ToLower)
.UseLazyLoading(true)
.UseMonitorCommand(
cmd => Trace.WriteLine("\r\n线程" + Thread.CurrentThread.ManagedThreadId + ": " + cmd.CommandText) //监听SQL命令对象在执行前
@ -60,7 +60,7 @@ public class g
.UseAutoSyncStructure(true)
//.UseGenerateCommandParameterWithLambda(true)
.UseLazyLoading(true)
.UseSyncStructureToUpper(true)
.UseNameConvert(FreeSql.Internal.NameConvertType.ToUpper)
//.UseNoneCommandParameter(true)
.UseMonitorCommand(