关于EF 动态条件,该如何解决

关于EF 动态条件pubilc listc getAllByWhere(string sqlWhere){var retruns (from p in context.Afrom

关于EF 动态条件
pubilc list<c> getAllByWhere(string sqlWhere)
{
  var retruns = (from p in context.A
  from q in context.B
  where p.name = sqlWhere)
  select new c
  {

  }.toList();
}


大致就是这段程序 如果 sqlWhere == "" 红色部分不应该出现

这样 如何处理 谢谢各位拉  
 

[解决办法]
给个示例

C# code
pubilc list<c> FindList(string name, int? type){    using(var context = Factory.Create())    {        var query = context.A;        if(name != null)            query = query.Where(x => x.Name.Contains(name));        if(type != null && type.HasValue)            query = query.Where(x => x.Type == type.Value);                    var result = from p in query                     from q in context.B where p.ID == q.ID                     select ...        return result.ToList();    }}