123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- using System;
- using System.Collections.Generic;
- using System.Data.Common;
- using System.Linq;
- using System.Text;
- using System.Data.Entity.Infrastructure;
- using System.Data.Entity;
- using System.Linq.Expressions;
- using Central.Control.Domain;
- using Ant.Service.Common;
- namespace MES.Production.Service
- {
-
-
-
-
- public interface IRepository<T> where T : class
- {
- #region 数据对象操作
-
-
-
- DbContext Context { get; }
-
-
-
- MyConfig Config { get; }
-
-
-
- DbSet<T> dbSet { get; }
-
-
-
- DbContextTransaction Transaction { get; set; }
-
-
-
- bool Committed { get; set; }
-
-
-
- void Commit();
-
-
-
- void Rollback();
- #endregion
- #region 单模型操作
-
-
-
-
-
- T Get(Expression<Func<T, bool>> predicate);
-
-
-
-
-
- bool Save(T entity);
-
-
-
-
-
- T SaveReturn(T entity);
-
-
-
-
- bool Update(T entity);
-
-
-
-
- bool SaveOrUpdate(T entity, bool isEdit);
-
-
-
-
-
-
- T SaveOrUpdateReturn(T entity, bool isEdit);
-
-
-
- int Delete(Expression<Func<T, bool>> predicate = null);
-
-
-
- int DeleteBySql(string sql, params DbParameter[] para);
-
-
-
- bool IsExist(Expression<Func<T, bool>> predicate);
-
-
-
- bool IsExist(string sql, params DbParameter[] para);
- #endregion
- #region 多模型操作
-
-
-
- int SaveList<T1>(List<T1> t) where T1 : class;
-
-
-
- int SaveList(List<T> t);
-
-
-
- int UpdateList<T1>(List<T1> t) where T1 : class;
-
-
-
- int UpdateList(List<T> t);
-
-
-
- int DeleteList(List<T> t);
-
-
-
- int DeleteList<T1>(List<T1> t) where T1 : class;
- #endregion
- #region 存储过程操作
-
-
-
- object ExecuteProc(string procname, params DbParameter[] parameter);
-
-
-
- object ExecuteQueryProc(string procname, params DbParameter[] parameter);
- #endregion
- #region 查询多条数据
-
-
-
- IQueryable<T> LoadAll(Expression<Func<T, bool>> predicate);
-
-
-
- List<T> LoadListAll(Expression<Func<T, bool>> predicate);
-
-
-
- DbQuery<T> LoadQueryAll(Expression<Func<T, bool>> predicate);
-
-
-
- IEnumerable<T> LoadEnumerableAll(string sql, params DbParameter[] para);
-
-
-
- System.Collections.IEnumerable LoadEnumerable(string sql, params DbParameter[] para);
-
-
-
- List<T> SelectBySql(string sql, params DbParameter[] para);
- List<T1> SelectBySql<T1>(string sql, params DbParameter[] para);
-
-
-
-
-
-
-
-
-
-
-
- List<TResult> QueryEntity<TEntity, TOrderBy, TResult>(Expression<Func<TEntity, bool>> where, Expression<Func<TEntity, TOrderBy>> orderby, Expression<Func<TEntity, TResult>> selector, bool IsAsc)
- where TEntity : class
- where TResult : class;
-
-
-
-
-
-
-
-
-
-
- List<object> QueryObject<TEntity, TOrderBy>(Expression<Func<TEntity, bool>> where, Expression<Func<TEntity, TOrderBy>> orderby, Func<IQueryable<TEntity>, List<object>> selector, bool IsAsc)
- where TEntity : class;
-
-
-
-
-
-
-
-
-
-
- dynamic QueryDynamic<TEntity, TOrderBy>(Expression<Func<TEntity, bool>> where, Expression<Func<TEntity, TOrderBy>> orderby, Func<IQueryable<TEntity>, List<object>> selector, bool IsAsc)
- where TEntity : class;
- #endregion
- #region 分页查询
-
-
-
-
-
-
-
- IList<T1> PageByListSql<T1>(string sql, IList<DbParameter> parameters, PageCollection page);
- IList<T> PageByListSql(string sql, IList<DbParameter> parameters, PageCollection page);
-
-
-
-
-
-
-
-
-
-
-
-
- PageInfo<object> Query<TEntity, TOrderBy>
- (int index, int pageSize,
- Expression<Func<TEntity, bool>> where,
- Expression<Func<TEntity, TOrderBy>> orderby,
- Func<IQueryable<TEntity>, List<object>> selector,
- bool IsAsc)
- where TEntity : class;
-
-
-
-
-
-
-
- PageInfo<T> Query(IQueryable<T> query, int index, int PageSize);
-
-
-
-
-
-
-
-
-
-
-
- PageInfo Query(int index, int pageSize, string tableName, string field, string filter, string orderby, string group, params DbParameter[] para);
-
-
-
-
-
-
-
- PageInfo Query(int index, int pageSize, string sql, string orderby, params DbParameter[] para);
-
-
-
- PageInfo Query(IQueryable query, int index, int pagesize);
- #endregion
- #region ADO.NET增删改查方法
-
-
-
- object ExecuteSqlCommand(string sql, params DbParameter[] para);
-
-
-
- object ExecuteSqlCommand(Dictionary<string, object> sqllist);
-
-
-
- object ExecuteSqlQuery(string sql, params DbParameter[] para);
- #endregion
- }
- }
|