Join between in memory collection and EntityFramework

前端 未结 4 1340
闹比i
闹比i 2020-12-30 04:11

Is there any mechanism for doing a JOIN between an in-memory collection and entity framework while preserving the order.

What I am trying is

var ite         


        
4条回答
  •  悲哀的现实
    2020-12-30 04:20

    try this:

    var list = (from n in efRepo
               where myInMemoryList.Select(m=>m.RECORD_NUMBER).Contains(n.RECORD_NUMBER)
               select n).ToList();
    

    Contains will be translated to IN operator in SQL (only if your RECORD_NUMBER member is a primitive type like int, string, Guid, etc)

提交回复
热议问题