using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; namespace HHWMS.Web { public interface IUnitWork { T FindSingle(Expression> where) where T : class; T FindById(Guid id) where T : class; T FindById(int id) where T : class; IQueryable Find(Expression> where) where T : class; bool IsExit(Expression> where) where T : class; int GetCount(Expression> where) where T : class; int Add(T entity) where T : class; int BatchAdd(IEnumerable entities) where T : class; /// /// 添加到历史表,并将原数据删除 /// /// 历史表 表名 /// 条件 /// 实体类 /// int AddToHistory(string name, Expression> where, Expression> entity) where T : class; int Update(T entity) where T : class; int BatchUpdate(IEnumerable entities) where T : class; /// /// 根据条件更新 /// /// /// /// /// int BatchUpdate(Expression> where, Expression> entity) where T : class; int Delete(T entity) where T : class; /// /// 根据条件 批量删除 /// /// /// 条件 /// int BatchDelete(Expression> where) where T : class; int DeleteById(T entity) where T : class; int DeleteById(int id) where T : class; int BatchDelete(IEnumerable entities) where T : class; int Save(); string GetSerialNumber(string prefix, int length = 4); } }