OracleUpdateable.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace SqlSugar
  7. {
  8. public class OracleUpdateable<T> : UpdateableProvider<T> where T : class, new()
  9. {
  10. protected override List<string> GetIdentityKeys()
  11. {
  12. return this.EntityInfo.Columns.Where(it => it.OracleSequenceName.HasValue()).Select(it => it.DbColumnName).ToList();
  13. }
  14. public override int ExecuteCommand()
  15. {
  16. if (base.UpdateObjs.Count() == 1)
  17. {
  18. var resultl= base.ExecuteCommand();
  19. if (resultl == -1)
  20. {
  21. return 1;
  22. }
  23. else
  24. {
  25. return resultl;
  26. }
  27. }
  28. else if (base.UpdateObjs.Count() == 0)
  29. {
  30. return 0;
  31. }
  32. else
  33. {
  34. base.ExecuteCommand();
  35. return base.UpdateObjs.Count();
  36. }
  37. }
  38. public async override Task<int> ExecuteCommandAsync()
  39. {
  40. if (base.UpdateObjs.Count() == 1)
  41. {
  42. var result= await base.ExecuteCommandAsync();
  43. if (result == -1)
  44. {
  45. return 1;
  46. }
  47. else
  48. {
  49. return result;
  50. }
  51. }
  52. else if (base.UpdateObjs.Count() == 0)
  53. {
  54. return 0;
  55. }
  56. else
  57. {
  58. await base.ExecuteCommandAsync();
  59. return base.UpdateObjs.Count();
  60. }
  61. }
  62. }
  63. }