开发者

What are the best practises to improve the application performace while using LINQ Queries?

开发者 https://www.devze.com 2023-01-30 20:24 出处:网络
Could any one tell me how to impr开发者_高级运维ove the application performance while writing LINQ Queries ?Like the optimization techniques.I think that:

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消