How To Count Associated Entities Without Fetching Them In Entity Framework

后端 未结 6 1495
伪装坚强ぢ
伪装坚强ぢ 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条回答
  •  -上瘾入骨i
    2021-01-30 21:07

    I've come across the same issue when dealing with multiple mappers including EF and DevExpress XPO (which doesn't even allow a single entity to map to multiple tables). What I found to be the best solution is to basically use the EDMX and T4 templates to generate updatable views in SQL Server (with instead of triggers) and that way you have low level control over the sql so you can do sub-queries in select clause, use all kinds of complex joins to bring in data and so on.

提交回复
热议问题