using System.Data; using System.Linq.Expressions; using Model.Base; namespace Repository { public interface IBaseRepository : ISimpleClient where T : class, new() { #region add int Add(T t, bool ignoreNull = true); int Insert(List t); int Insert(T parm, Expression> iClumns = null, bool ignoreNull = true); IInsertable Insertable(T t); #endregion add #region update int Update(T entity, bool ignoreNullColumns = false, object data = null); /// /// 只更新表达式的值 /// /// /// /// int Update(T entity, Expression> expression, bool ignoreAllNull = false); int Update(T entity, Expression> expression, Expression> where); int Update(Expression> where, Expression> columns); #endregion update DbResult UseTran(Action action); DbResult UseTran(SqlSugarClient client, Action action); bool UseTran2(Action action); #region delete IDeleteable Deleteable(); int Delete(object[] obj, string title = ""); int Delete(object id, string title = ""); int DeleteTable(); bool Truncate(); #endregion delete #region query /// /// 根据条件查询分页数据 /// /// /// /// PagedInfo GetPages(Expression> where, PagerInfo parm); PagedInfo GetPages(Expression> where, PagerInfo parm, Expression> order, OrderByType orderEnum = OrderByType.Asc); PagedInfo GetPages(Expression> where, PagerInfo parm, Expression> order, string orderByType); bool Any(Expression> expression); ISugarQueryable Queryable(); List GetAll(bool useCache = false, int cacheSecond = 3600); List SqlQueryToList(string sql, object obj = null); T GetId(object pkValue); #endregion query #region Procedure DataTable UseStoredProcedureToDataTable(string procedureName, List parameters); (DataTable, List) UseStoredProcedureToTuple(string procedureName, List parameters); #endregion Procedure } }