动态Include 问题
--------------------编程问答-------------------- 上下文?
public List<T> FindListByExpression(Expression<Func<T, bool>> where, string greedyLoad = "")
{
try
{
using (context = new qqMarketingEntities1())
{
var query = context.Set<T>();
if (!string.IsNullOrEmpty(greedyLoad))
{
List<string> greedyLoads = greedyLoad.Split(',').ToList();
/*foreach (var i in greedyLoads)
{
query.Include(i);
}
query.Where(where);*/无法查询,请问这里如何修改
}
List<T> result = query.ToList<T>();
return result;
}
}
catch (Exception e)
{
throw e;
}
}
报什么错? --------------------编程问答-------------------- 原来的写法不报错,只是找不到数据 --------------------编程问答--------------------
--------------------编程问答-------------------- 反射       --------------------编程问答--------------------
foreach (var i in greedyLoads){
query = query.Include(i);
}
query = query.Where(where);
--------------------编程问答--------------------
public List<T> FindListByExpression(Func<T, bool> where, string greedyLoad = "")
补充:.NET技术 , LINQ