// *********************************************************************** // Assembly : OpenAuth.Domain // Author : yubaolee // Created : 10-25-2015 // // Last Modified By : yubaolee // Last Modified On : 10-25-2015 // *********************************************************************** // // Copyright (c) www.cnblogs.com/yubaolee. All rights reserved. // // 仓储接口 // *********************************************************************** using System; using System.Linq; using System.Linq.Expressions; namespace OpenAuth.Domain.Interface { public interface IRepository where T : class { T FindSingle(Expression> exp = null); bool IsExist(Expression> exp); IQueryable Find(Expression> exp = null); IQueryable Find(int pageindex = 1, int pagesize = 10, string orderby = "", Expression> exp = null); int GetCount(Expression> exp = null); void Add(T entity); void BatchAdd(T[] entities); /// /// 更新一个实体的所有属性 /// void Update(T entity); void Delete(T entity); /// /// 按指定的ID进行批量更新 /// void Update(Expression> identityExp, T entity); /// /// 实现按需要只更新部分更新 /// 如:Update(u =>u.Id==1,u =>new User{Name="ok"}); /// /// 更新条件 /// 更新后的实体 void Update(Expression> where, Expression> entity); /// /// 批量删除 /// void Delete(Expression> exp); void Save(); } }