How To Count Associated Entities Without Fetching Them In Entity Framework

后端 未结 6 1494
伪装坚强ぢ
伪装坚强ぢ 2021-01-30 20:50

I\'ve been wondering about this one for a while now, so I thought it would be worth using my first Stack Overflow post to ask about it.

Imagine I have a discussion with

6条回答
  •  遥遥无期
    2021-01-30 21:11

    I don't have a direct answer but can only point you to the following comparison between NHibernate and EF 4.0 which seems to suggest that even in EF 4.0 there is no out of the box support for getting counts of a related entity collection without retrieving the collection.

    http://ayende.com/Blog/archive/2010/01/05/nhibernate-vs.-entity-framework-4.0.aspx

    I've upvoted and starred your question. Hopefully someone will chime in with a workable solution.

提交回复
热议问题