- 修复 LoadSchemasAndNavigates ManyToMany 循环检测问题;

This commit is contained in:
2881099
2025-04-26 20:53:39 +08:00
parent 60b54ac471
commit c61e3f789d
3 changed files with 10 additions and 170 deletions

View File

@@ -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());