LINQ to SQL公共基类 demo
public Form1() { InitializeComponent(); } private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //XtraForm1 frm = new XtraForm1(); //frm.ShowDialog(); var old = DbFactory<Users>.Instance.GetSingle(f => f.UserID == 2); old.TrueName = DateTime.Now.ToString(); DbFactory<Users>.Instance.Update(); } private void Form1_Load(object sender, EventArgs e) { var list = DbFactory<Users>.Instance.GetAll().Take(10); this.gridControl1.DataSource = list; } private void barButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { } private void barButtonItem6_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { string msg = DbFactory<Users>.Instance.GetSingle(f => f.UserID == 1).UserName; DevExpress.XtraEditors.XtraMessageBox.Show(msg); } private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Form1_Load(null, null); } private void barButtonItem7_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { var msg = DbFactory<Notice>.Instance.GetSingle().NoticeTitle; DevExpress.XtraEditors.XtraMessageBox.Show(msg); }
============ 欢迎各位老板打赏~ ===========
与本文相关的文章
- · 轻量级ORM框架(六):处理表达式树
- · 轻量级ORM框架(二):LinqToDB查询
- · LINQ to SQLite完美解决方案
- · C#函数式程序编程2
- · linq查询效率测试
- · linq里LIKE的几种用法
- · Entity Framework入门到精通(一)-概念及架构
- · LINQ无主键无法更新表
- · LINQ查询返回DataTable类型
- · The instance of entity type ‘Customer’ cannot be tracked because another instance with the same key value for {‘Id’} is already being tracked.
- · .NET8实时更新nginx ip地址归属地
- · 解决.NET Blazor子组件不刷新问题