Demo4_Deleteable.cs 808 B

1234567891011121314151617181920212223242526272829303132
  1. using SqlSugar;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using Uninpho.DBOperation.Model;
  6. namespace Uninpho.DBOperation.Operation
  7. {
  8. public class Demo4_Deleteable
  9. {
  10. public static void Test()
  11. {
  12. SqlSugarClient db = Config.GetPgClient();
  13. //by entity
  14. db.Deleteable<User>().Where(new User() { Id = 1111 }).ExecuteCommand();
  15. //by primary key
  16. db.Deleteable<User>().In(1111).ExecuteCommand();
  17. //by primary key array
  18. db.Deleteable<User>().In(new int[] { 1111, 2222 }).ExecuteCommand();
  19. //by expression
  20. db.Deleteable<User>().Where(it => it.Id == 11111).ExecuteCommand();
  21. Console.WriteLine("#### Deleteable End ####");
  22. }
  23. }
  24. }