DeleteMethodInfo.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Reflection;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace SqlSugar
  8. {
  9. public class DeleteMethodInfo
  10. {
  11. internal SqlSugarProvider Context { get; set; }
  12. internal MethodInfo MethodInfo { get; set; }
  13. internal object objectValue { get; set; }
  14. public int ExecuteCommand()
  15. {
  16. if (Context == null) return 0;
  17. var inertable=MethodInfo.Invoke(Context, new object[] { objectValue });
  18. var result= inertable.GetType().GetMethod("ExecuteCommand").Invoke(inertable,new object[] { });
  19. return (int)result;
  20. }
  21. public async Task<int> ExecuteCommandAsync()
  22. {
  23. if (Context == null) return 0;
  24. var inertable = MethodInfo.Invoke(Context, new object[] { objectValue });
  25. var result = inertable.GetType().GetMyMethod("ExecuteCommandAsync",0).Invoke(inertable, new object[] { });
  26. return await(Task<int>)result;
  27. }
  28. public CommonMethodInfo AS(string tableName)
  29. {
  30. var inertable = MethodInfo.Invoke(Context, new object[] { objectValue });
  31. var newMethod = inertable.GetType().GetMyMethod("AS", 1, typeof(string));
  32. var result = newMethod.Invoke(inertable, new object[] { tableName });
  33. return new CommonMethodInfo()
  34. {
  35. Context = result
  36. };
  37. }
  38. public CommonMethodInfo SplitTable()
  39. {
  40. var inertable = MethodInfo.Invoke(Context, new object[] { objectValue });
  41. var newMethod = inertable.GetType().GetMyMethod("SplitTable", 0);
  42. var result = newMethod.Invoke(inertable, new object[] { });
  43. return new CommonMethodInfo()
  44. {
  45. Context = result
  46. };
  47. }
  48. }
  49. }