How to COUNT rows within EntityFramework without loading contents?

后端 未结 7 1353
一个人的身影
一个人的身影 2020-11-29 17:56

I\'m trying to determine how to count the matching rows on a table using the EntityFramework.

The problem is that each row might have many

7条回答
  •  被撕碎了的回忆
    2020-11-29 18:28

    I think you want something like

    var count = context.MyTable.Count(t => t.MyContainer.ID == '1');
    

    (edited to reflect comments)

提交回复
热议问题