各位老兄,有谁知道Linq.Dynamic(动态查询)何加in条件
代码如下:
 
private IEnumerable ExeSelect(IQueryable Iq)
    {
        string[] cities =new string[] { "Seattle", "London", "Vancouver", "Paris" };        List<object> lo = new List<object>();
        lo.Add("王一波测试");
        lo.Add("d");
        lo.Add(1);
        return Iq.Where("FZwmc==@0 or FZwmc.Contains(@1) and Fid=@2", lo.ToArray())
            .Select("new(Fid, FZwmc)")
            .OrderBy("Fid desc,FZwmc asc")
            .Take(10);
    }
如果我想FZwmc in("Seattle", "London", "Vancouver", "Paris" )做为条件,如何操作呢?

解决方案 »

  1.   

    我只知道使用查询模式,如果你可以得到帮助最好。反正基本不用.号的方法,逻辑不好把握。            List<string> a = new List<string>();
                string[] b = new string[] { "Seattle", "London", "Vancouver", "Paris" };
                var t = from x in a
                        from y in b
                        where x == y
                        select x;
      

  2.   

    string[] names= new string[] { "A", "B", "C", "D" };
    var q = db.Users.Where(p=>names.Contains(p.name)).ToList();
    参考