mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-27 11:19:15 +08:00
Delete BUG with multiple primary keys
This commit is contained in:
@@ -56,6 +56,20 @@ namespace OrmTest
|
||||
base.Check(@"DELETE FROM [STudent] WHERE id=@id", new List<SugarParameter>() {
|
||||
new SugarParameter("@id",1)
|
||||
}, t6.Key, t6.Value, "Delte t6 error");
|
||||
|
||||
var t7 = base.GetInstanceByAttribute().Deleteable<DeleteTestTable>().Where(new List<DeleteTestTable>() {
|
||||
new DeleteTestTable() { Id=1, Id2="x" },
|
||||
new DeleteTestTable() { Id=2, Id2="x1" }
|
||||
}).ToSql();
|
||||
base.Check("DELETE FROM [DeleteTestTable] WHERE (([Id]=N'1'AND [Id2]=N'x')OR ([Id]=N'2'AND [Id2]=N'x1')) ",null, t7.Key, null,
|
||||
"Delte t7 error");
|
||||
}
|
||||
}
|
||||
|
||||
public class DeleteTestTable {
|
||||
[SugarColumn(IsPrimaryKey =true)]
|
||||
public int Id { get; set; }
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public string Id2 { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,5 +51,11 @@ namespace OrmTest.UnitTest
|
||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
|
||||
return db;
|
||||
}
|
||||
|
||||
public SqlSugarClient GetInstanceByAttribute()
|
||||
{
|
||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { InitKeyType=InitKeyType.Attribute, ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
|
||||
return db;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user