CSFramework.EF 数据库框架 - 测试 Update 方法更新对象
C# 全选
private void button7_Click(object sender, EventArgs e)
{
//
//测试Update方法,www.csframework.com
//
string connString = "Server=127.0.0.1;Database=CSFrameworkV6_Normal;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 = "";
list[0].Remark = $"修改了:{DateTime.Now.ToString()},{IdHelper.GetGuid()}";
list[1].Remark = $"修改了:{DateTime.Now.ToString()},{IdHelper.GetGuid()}";
list[2].Remark = $"修改了:{DateTime.Now.ToString()},{IdHelper.GetGuid()}";
result += db.Update(list[0]);
result += db.Update(list[1]);
result += db.Update(list[2]);
list[3].Remark = $"修改了:{DateTime.Now.ToString()},{IdHelper.GetGuid()}";
list[4].Remark = $"修改了:{DateTime.Now.ToString()},{IdHelper.GetGuid()}";
list[5].Remark = $"修改了:{DateTime.Now.ToString()},{IdHelper.GetGuid()}";
result += db.Update(list.GetRange(3, 3));
textBox1.Text = result;
}
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
CSFramework.EF C/S框架网