1,Logic,引用Entity
private AOSDataContext context;
public UserDAL()
: this(new AOSDataContext())
{ }
public UserDAL(AOSDataContext context)
{
this.context = context;
}
/// <summary>
/// 获取导出数据
/// </summary>
/// <param name="sortClause">排序</param>
/// <param name="expWhere">查询</param>
/// <returns></returns>
public DataTable GetExportData(string sortClause, Expression<Func<Comm_User, bool>> expWhere, params string[] ids)
{
var q = context.Comm_Users.AsQueryable();
if (expWhere != null)
q = q.Where(expWhere);
q.OrderBy(sortClause);
var query = from m in q
where ids.Contains(m.uid.ToString())
select m;
return query.ToDataTable(context);
}
2,Business,引用Entity、Logic和Facede
/// <summary>
/// 获取导出数据
/// </summary>
/// <param name="sortClause">排序</param>
/// <returns></returns>
public DataTable GetExportData(string sortClause, Expression<Func<Comm_User, bool>> expWhere, params string[] ids)
{
using (AOSDataContext context = new AOSDataContext())
{
UserDAL uDAL = new UserDAL(context);
return uDAL.GetExportData(sortClause, expWhere,ids);
}
}
3,Facede,引用Entity
/// <summary>
/// 获取导出数据
/// </summary>
/// <param name="sortClause">排序</param>
/// <returns></returns>
DataTable GetExportData(string sortClause, Expression<Func<Comm_User, bool>> expWhere,params string[] ids);
4,UI,引用Entity和Facede
private Iuser userMgr;
DataTable expData = userMgr.GetExportData("uid", confition, ids);