Does anyone know why, by default, entity framework loads all related enitites when querying a table?
I have tried manually enabling lazyloading, but when I run SQL Profiler while executing the query i can still see a Stored Procedure being executed for each related entity table.
This severly impacts the performance & amount of db calls made. I have resorted to creating anonymous objects for each call to limit the records to only the specific ones I want.
Comparison: Normal query on a Customer in my table returns the customer, with all invoices, all quotes, all contacts, etc.
I just need the main info related to the customer eg. Name, Address etc.
My point is, is it not very inefficient to always call all related entities? And would that cripple your SQL server when you have 100+ users working on it?
Had to redo all my queries in entity framework to use the select clause, and lo and behold speed/response increases are through the roof.
I have tried manually enabling lazyloading, but when I run SQL Profiler while executing the query i can still see a Stored Procedure being executed for each related entity table.
This severly impacts the performance & amount of db calls made. I have resorted to creating anonymous objects for each call to limit the records to only the specific ones I want.
Comparison: Normal query on a Customer in my table returns the customer, with all invoices, all quotes, all contacts, etc.
I just need the main info related to the customer eg. Name, Address etc.
My point is, is it not very inefficient to always call all related entities? And would that cripple your SQL server when you have 100+ users working on it?
Had to redo all my queries in entity framework to use the select clause, and lo and behold speed/response increases are through the roof.