using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OrmTest { public class Demo6_Queue { public static void Init() { Console.WriteLine(""); Console.WriteLine("#### Queue Start ####"); SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { DbType = DbType.Access, ConnectionString = Config.ConnectionString, InitKeyType = InitKeyType.Attribute, IsAutoCloseConnection = true, AopEvents = new AopEvents { OnLogExecuting = (sql, p) => { Console.WriteLine(sql); Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value))); } } }); db.Insertable(new Order() { Name = "a" }).AddQueue(); db.Insertable(new Order() { Name = "b" }).AddQueue(); db.SaveQueues(); db.Insertable(new Order() { Name = "a" }).AddQueue(); db.Insertable(new Order() { Name = "b" }).AddQueue(); db.Insertable(new Order() { Name = "c" }).AddQueue(); db.Insertable(new Order() { Name = "d" }).AddQueue(); var ar = db.SaveQueuesAsync(); ar.Wait(); db.Queryable().AddQueue(); db.Queryable().AddQueue(); db.AddQueue("select * from [Order] where id=@id", new { id = 10000 }); db.AddQueue("select id=@id+1", new { id = 10000 }); var result2 = db.SaveQueues(); Console.WriteLine("#### Queue End ####"); } } }