CSFramework.EF 数据库框架 - 测试 Remove 方法删除对象
IDatabase.Remove泛型方法
C# 全选
private void button6_Click(object sender, EventArgs e)
{
//
//测试Remove方法,www.csframework.com
//
string connString = "Server=127.0.0.1;Database=CSFramework_WebAPI_V3;User ID=demo_webapi;Password=test; Max Pool Size=512; Pooling=true;Connect Timeout=30;TrustServerCertificate=true;";
IDatabase db = DatabaseFactory.GetDatabase(DatabaseType.SqlServer, connString);
var list = db.GetQueryable<tb_PO>().OrderByDescending(o => o.PODate).Take(10).ToList();
var result = "";
result += db.Remove<tb_PO>(list[0]);
result += db.Remove<tb_PO>(list[1]);
result += db.Remove<tb_PO>(list.GetRange(2, 5));
textBox1.Text = result;
}
指定表名、关键字段名、键值删除
C# 全选
db.Remove(nameof(_Demo_Customer), "isid", new List<string> { "392288532373510" });
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
CSFramework.EF C/S框架网