Linq to Entities - SQL “IN” clause

前端 未结 8 1251
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 05:10

In T-SQL you could have a query like:

SELECT * FROM Users WHERE User_Rights IN (\"Admin\", \"User\", \"Limited\")

How would you replicate t

8条回答
  •  [愿得一人]
    2020-11-22 05:48

    Real example:

    var trackList = Model.TrackingHistory.GroupBy(x => x.ShipmentStatusId).Select(x => x.Last()).Reverse();
    List done_step1 = new List() {2,3,4,5,6,7,8,9,10,11,14,18,21,22,23,24,25,26 };
    bool isExists = trackList.Where(x => done_step1.Contains(x.ShipmentStatusId.Value)).FirstOrDefault() != null;
    

提交回复
热议问题