IUpdateable.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. using NetTaste;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Linq.Expressions;
  6. using System.Security.Permissions;
  7. using System.Text;
  8. using System.Threading;
  9. using System.Threading.Tasks;
  10. namespace SqlSugar
  11. {
  12. public interface IUpdateable<T> where T : class, new()
  13. {
  14. UpdateBuilder UpdateBuilder { get; set; }
  15. bool UpdateParameterIsNull { get; set; }
  16. int ExecuteCommandWithOptLock(bool isThrowError = false);
  17. int ExecuteCommandWithOptLockIF(bool? IsVersionValidation, bool? IsOptLock = null);
  18. Task<int> ExecuteCommandWithOptLockAsync(bool isThrowError = false);
  19. int ExecuteCommand();
  20. bool ExecuteCommandHasChange();
  21. Task<int> ExecuteCommandAsync();
  22. Task<int> ExecuteCommandAsync(CancellationToken token);
  23. Task<bool> ExecuteCommandHasChangeAsync();
  24. Task<bool> ExecuteCommandHasChangeAsync(CancellationToken token);
  25. IUpdateable<T> AS(string tableName);
  26. IUpdateable<T> AsType(Type tableNameType);
  27. IUpdateable<T> With(string lockString);
  28. IUpdateable<T> In<PkType>(Expression<Func<T, object>> inField, ISugarQueryable<PkType> childQueryExpression);
  29. IUpdateable<T> Where(Expression<Func<T, bool>> expression);
  30. IUpdateable<T> WhereIF(bool isWhere,Expression<Func<T, bool>> expression);
  31. IUpdateable<T> Where(string whereSql,object parameters=null);
  32. /// <summary>
  33. ///
  34. /// </summary>
  35. /// <param name="fieldName"></param>
  36. /// <param name="conditionalType">for example : = </param>
  37. /// <param name="fieldValue"></param>
  38. /// <returns></returns>
  39. IUpdateable<T> Where(string fieldName, string conditionalType, object fieldValue);
  40. /// <summary>
  41. /// Non primary key entity update function,.WhereColumns(it=>new{ it.Id })
  42. /// </summary>
  43. /// <param name="columns"></param>
  44. /// <returns></returns>
  45. IUpdateable<T> WhereColumns(Expression<Func<T, object>> columns);
  46. IUpdateable<T> WhereColumns(string columnName);
  47. IUpdateable<T> WhereColumns(params string [] columnNames);
  48. IUpdateable<T> Where(List<IConditionalModel> conditionalModels);
  49. /// <summary>
  50. /// .UpdateColumns(it=>new{ it.Name,it.Price})
  51. /// </summary>
  52. /// <param name="columns"></param>
  53. /// <returns></returns>
  54. IUpdateable<T> UpdateColumns(Expression<Func<T, object>> columns);
  55. IUpdateable<T> UpdateColumns(Expression<Func<T, object>> columns, bool appendColumnsByDataFilter);
  56. IUpdateable<T> UpdateColumns(params string[] columns);
  57. IUpdateable<T> UpdateColumns(string[] columns,bool appendColumnsByDataFilter);
  58. /// <summary>
  59. ///.SetColumns(it=>it.Name=="a")
  60. /// </summary>
  61. /// <param name="columns"></param>
  62. /// <returns></returns>
  63. IUpdateable<T> SetColumns(Expression<Func<T, bool>> columns);
  64. /// <summary>
  65. /// .SetColumns(it=> new class() { it.Name="a",it.Price=0})
  66. /// </summary>
  67. /// <param name="columns"></param>
  68. /// <returns></returns>
  69. IUpdateable<T> SetColumns(Expression<Func<T, T>> columns);
  70. IUpdateable<T> SetColumns(Expression<Func<T, T>> columns,bool appendColumnsByDataFilter);
  71. IUpdateable<T> SetColumns(string fieldName,object fieldValue);
  72. IUpdateable<T> SetColumns(Expression<Func<T,object>> filedNameExpression, object fieldValue);
  73. IUpdateable<T> SetColumns(Expression<Func<T, object>> filedNameExpression, Expression<Func<T, object>> valueExpression);
  74. IUpdateable<T> SetColumnsIF(bool isUpdateColumns, Expression<Func<T, object>> filedNameExpression, object fieldValue);
  75. IUpdateable<T> UpdateColumnsIF(bool isUpdateColumns,Expression<Func<T, object>> columns);
  76. IUpdateable<T> UpdateColumnsIF(bool isUpdateColumns, params string[] columns);
  77. IUpdateable<T> SetColumnsIF(bool isUpdateColumns,Expression<Func<T, T>> columns);
  78. IUpdateable<T> SetColumnsIF(bool isUpdateColumns, Expression<Func<T, bool>> columns);
  79. IUpdateable<T> IgnoreColumns(bool ignoreAllNullColumns, bool isOffIdentity = false, bool ignoreAllDefaultValue = false);
  80. IUpdateable<T> IgnoreColumns(Expression<Func<T, object>> columns);
  81. IUpdateable<T> IgnoreColumnsIF(bool isIgnore, Expression<Func<T, object>> columns);
  82. IUpdateable<T> IgnoreColumns(params string[] columns);
  83. IUpdateable<T> IgnoreNullColumns(bool isIgnoreNull=true);
  84. IUpdateable<T> IsEnableUpdateVersionValidation();
  85. IUpdateable<T> EnableDiffLogEvent(object businessData = null);
  86. IUpdateable<T> EnableDiffLogEventIF(bool isEnableDiffLog,object businessData = null);
  87. IUpdateable<T> ReSetValue(Action<T> setValueExpression);
  88. IUpdateable<T> PublicSetColumns(Expression<Func<T, object>> filedNameExpression,string computationalSymbol);
  89. IUpdateable<T> PublicSetColumns (Expression<Func<T,object>> filedNameExpression, Expression<Func<T, object>> ValueExpExpression);
  90. IUpdateable<T> RemoveDataCache();
  91. IUpdateable<T> RemoveDataCache(string likeString);
  92. IUpdateable<T> CallEntityMethod(Expression<Action<T>> method);
  93. KeyValuePair<string,List<SugarParameter>> ToSql();
  94. string ToSqlString();
  95. void AddQueue();
  96. SplitTableUpdateProvider<T> SplitTable(Func<List<SplitTableInfo>, IEnumerable<SplitTableInfo>> getTableNamesFunc);
  97. SplitTableUpdateByObjectProvider<T> SplitTable();
  98. IUpdateable<T> EnableQueryFilter();
  99. IUpdateable<T> Clone();
  100. IUpdateable<T,T2> InnerJoin<T2>(Expression<Func<T,T2,bool>> joinExpress);
  101. IUpdateable<T, T2> InnerJoin<T2>(Expression<Func<T, T2, bool>> joinExpress,string tableName);
  102. UpdateablePage<T> PageSize(int pageSize);
  103. IUpdateable<T> In(object[] ids);
  104. }
  105. public interface IUpdateable<T, T2>
  106. {
  107. int ExecuteCommand();
  108. Task<int> ExecuteCommandAsync();
  109. IUpdateable<T, T2,T3> InnerJoin<T3>(Expression<Func<T, T2,T3, bool>> joinExpress);
  110. IUpdateable<T, T2> SetColumns(Expression<Func<T, T2,T>> columns);
  111. IUpdateable<T, T2> Where(Expression<Func<T, T2,bool>> whereExpression);
  112. }
  113. public interface IUpdateable<T, T2,T3>
  114. {
  115. IUpdateable<T, T2, T3,T4> InnerJoin<T4>(Expression<Func<T, T2, T3,T4, bool>> joinExpress);
  116. int ExecuteCommand();
  117. Task<int> ExecuteCommandAsync();
  118. IUpdateable<T, T2,T3> SetColumns(Expression<Func<T, T2,T3, T>> columns);
  119. IUpdateable<T, T2,T3> Where(Expression<Func<T, T2,T3, bool>> whereExpression);
  120. }
  121. public interface IUpdateable<T, T2, T3,T4>
  122. {
  123. int ExecuteCommand();
  124. Task<int> ExecuteCommandAsync();
  125. IUpdateable<T, T2, T3,T4> SetColumns(Expression<Func<T, T2, T3,T4, T>> columns);
  126. IUpdateable<T, T2, T3,T4> Where(Expression<Func<T, T2, T3,T4, bool>> whereExpression);
  127. }
  128. }