Search code examples
jsonentity-frameworkrepository-patternasp.net-web-api2poco

Performance Issues with Include in Entity Framework


I am working on a large application being developed using Repository Pattern, Web APIs, AngularJS. In one of the scenario, I am trying to retrieve data from a single lead which has relations with approx. 20 tables. Lazy loading is disable, so I am using Include to get the data from all the 20 tables. Now, here comes performance issue, if I try to retrieve single record, it takes approx. 15 seconds. This is a huge performance issue. I am returning JSON and my entities are decorated with DataContract(IsReference = true)/ Data Member attribute.

Any suggestions will be highly appreciated.


Solution

  • The performance has been improved by Enabling Lazy Loading.