mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-10 02:10:55 +08:00
- 修复 LoadSchemasAndNavigates ManyToMany 循环检测问题;
This commit is contained in:
@@ -15,62 +15,10 @@ using (var fsql = new FreeSqlBuilder()
|
||||
.UseMonitorCommand(cmd => Console.WriteLine(cmd.CommandText + "\r\n"))
|
||||
.Build())
|
||||
{
|
||||
var table1 = new TableDescriptor
|
||||
{
|
||||
Name = "aaa",
|
||||
DisableSyncStructure = false,
|
||||
Comment = "测试表"
|
||||
};
|
||||
table1.Columns.Add(new TableDescriptor.ColumnDescriptor
|
||||
{
|
||||
Name = "Column1",
|
||||
DbType = "varchar",
|
||||
IsPrimary = true,
|
||||
IsIdentity = true,
|
||||
IsNullable = false,
|
||||
MapType = typeof(string),
|
||||
Comment = "主键"
|
||||
});
|
||||
table1.Columns.Add(new TableDescriptor.ColumnDescriptor
|
||||
{
|
||||
Name = "Column2",
|
||||
DbType = "varchar",
|
||||
IsNullable = false,
|
||||
MapType = typeof(string),
|
||||
Comment = "名称"
|
||||
});
|
||||
var table2 = new TableDescriptor
|
||||
{
|
||||
Name = "bbb",
|
||||
DisableSyncStructure = false,
|
||||
Comment = "测试表"
|
||||
};
|
||||
table2.Columns.Add(new TableDescriptor.ColumnDescriptor
|
||||
{
|
||||
Name = "Column1",
|
||||
DbType = "varchar",
|
||||
IsPrimary = true,
|
||||
IsIdentity = true,
|
||||
IsNullable = false,
|
||||
MapType = typeof(string),
|
||||
Comment = "主键"
|
||||
});
|
||||
table2.Columns.Add(new TableDescriptor.ColumnDescriptor
|
||||
{
|
||||
Name = "Column2",
|
||||
DbType = "varchar",
|
||||
IsNullable = false,
|
||||
MapType = typeof(string),
|
||||
Comment = "名称"
|
||||
});
|
||||
var context = new ZeroDbContext(fsql, [table1, table2]);
|
||||
|
||||
var sql = context.Select
|
||||
.WhereExists(subQuery =>
|
||||
{
|
||||
return subQuery.From("bbb").Where("Column1", "aaa");
|
||||
}).ToSql();
|
||||
Console.WriteLine(sql);
|
||||
var schemas = JsonConvert.DeserializeObject<TableDescriptor[]>(File.ReadAllText(@"C:\Users\28810\Downloads\schema.json"));
|
||||
var context = new ZeroDbContext(fsql);
|
||||
context.LoadSchemasAndNavigates("Student", tableName => schemas.First(c => c.Name == tableName));
|
||||
|
||||
var json = JsonConvert.SerializeObject(Helper.GetTestDesc());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user