DbSet.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using SqlSugar;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. namespace TEAMModelOS.SDK.Module.SqlSugar.Configuration
  6. {
  7. /// <summary>
  8. /// 扩展ORM
  9. /// </summary>
  10. /// <typeparam name="T"></typeparam>
  11. public class DbSet<T> : SimpleClient<T> where T : class, new()
  12. {
  13. public DbSet(SqlSugarClient context) : base(context)
  14. {
  15. }
  16. /// <summary>
  17. /// 扩展假删除功能
  18. /// </summary>
  19. /// <typeparam name="DbModel"></typeparam>
  20. /// <param name="dbModel"></param>
  21. /// <returns></returns>
  22. public bool FalseDelete<DbModel>(DbModel dbModel) where DbModel : BaseDbModel, new()
  23. {
  24. return this.Context.Updateable<DbModel>(dbModel).UpdateColumns(it => new DbModel() { IsDel = true }).ExecuteCommand() > 0;
  25. }
  26. /// <summary>
  27. /// 扩展假删除功能
  28. /// </summary>
  29. /// <typeparam name="DbModel"></typeparam>
  30. /// <param name="dbModel"></param>
  31. /// <returns></returns>
  32. public bool FalseDelete<DbModel>(DbModel[] dbModels) where DbModel : BaseDbModel, new()
  33. {
  34. return this.Context.Updateable<DbModel>(dbModels).UpdateColumns(it => new DbModel() { IsDel = true }).ExecuteCommand() > 0;
  35. }
  36. }
  37. }