Entities as Linq: Counting takes a long time.

c# entity-framework linq

Question

It doesn't have a large database, but I need to include parent and parent.child.count() in the query, and doing so takes 20 seconds. Any suggestions for improvement?

var plist = context.persons
  .Select(p => new
  {
    p.fullName,
    c.personID,
    p.Status,
    p.Birthdate,
    p.Accounts.Count
  }).ToList();
1
3
11/16/2010 9:39:10 PM

Popular Answer

This excellent post explains how to use any instead of count() when you wanted to ()

http://blogs.teamb.com/craigstuntz/2010/04/21/38598/

4
11/16/2010 8:30:17 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow