Example: a database with 50,000 Customers. Each Customer is mapped M:1 to a Status table and the status can be one of 20 different statuses. Status has a navigation property to access Customers. Requirement is to allow users to search on "Live" customers only from a certain form. When coding this, it would not be unnatural for a developer to get the "Live" Status and then run all queries on Status.Customers. The problem with this is that it isn't obvious that this loads all "Live" Customers and then only queries in memory afterwards. This also means that these entities hang around in the change tracking and need to be checked for updates, which slows a whole load of stuff down and a lot of coders won't realise why it is taking so long.
I just discovered this because I was running some code which inadvertently loaded about half a million entities instead of the 450 odd that it actually needed. I spent ages trying to work out why my code was taking 12 seconds to do DbSet.Adds!!
Comments: While we don't want to change the default behavior we are tracking a work item to provide an easy way to opt into this - https://entityframework.codeplex.com/workitem/207
I just discovered this because I was running some code which inadvertently loaded about half a million entities instead of the 450 odd that it actually needed. I spent ages trying to work out why my code was taking 12 seconds to do DbSet.Adds!!
Comments: While we don't want to change the default behavior we are tracking a work item to provide an easy way to opt into this - https://entityframework.codeplex.com/workitem/207