Get Distinct Entries Based On Specific Column in Entity Framework

后端 未结 3 1236
暖寄归人
暖寄归人 2021-01-28 10:55

I have a SQLite table that contains every test result we\'ve run, and I\'m looking to write an entity framework query that returns only the most recent test result per project.

3条回答
  •  没有蜡笔的小新
    2021-01-28 11:48

    Your method couldn't be translated to T-SQL, Linq to Entities couldn't recognize it. You can modify the code as below (adding AsEnumerable after AsNoTracking):

    .Include(x => x.Project)
    .AsNoTracking()
    .AsEnumerable()
    

    With AsEnumerable after data is loaded, any further operation is performed using Linq to Objects, on the data already in memory.

提交回复
热议问题