What are the best practises to improve the application performace while using LINQ Queries?
Could any one tell me how to impr开发者_高级运维ove the application performance while writing LINQ Queries ?Like the optimization techniques.
I think that: 1) You must fetch only date that you need. 2) Use DataLoadOptions
DataLoadOptions options = new DataLoadOptions();
options.AssociateWith<Category>(cat=> cat.Products.Where<Product>(prod => prod.IsValid));
context.LoadOptions = options;
it is optimize you sql query.
3) Turn off ObjectTrackingEnabled
context.ObjectTrackingEnabled = false;
精彩评论