How can I do a Union all in Entity Framework LINQ To Entities?

前端 未结 2 1808
情书的邮戳
情书的邮戳 2021-01-03 18:27

I came across a scenario where I had to use Union all, how can I achieve so in LINQ to entities ?

2条回答
  •  一生所求
    2021-01-03 19:25

    I believe Concat is what you're looking for.

    var allResults = resultSet1.Concat(resultSet2);
    

    Obviously, both result sets must use the same type. And I believe there my be other requirements about how the result sets are constructed in the first place, but I don't know all the details.

提交回复
热议问题