Friday, 18 December 2015

ASP.NET Tips #62 - Delayed execution in EF can trip you up

If your Model exposes an IQueryable object, your View may actually run a query multiple times when it tries to read the object's data.

List properties in the Model should be of type IList to force the query to be executed once and only once.

It’s easy to spot these additional queries with a tool like ANTS Performance Profiler, which shows you what queries are being run by your application.

No comments :

Post a comment