.Include() vs .Load() performance in EntityFramework

后端 未结 6 2074
抹茶落季
抹茶落季 2020-11-28 04:01

When querying a large table where you need to access the navigation properties later on in code (I explicitly don\'t want to use lazy loading) what will perform better

6条回答
  •  时光说笑
    2020-11-28 04:34

    It's always hard to decide whether to go with Eager, Explicit or even Lazy Loading.
    What I would recommend anyway is always to perform some profiling. That's the only way to be sure your request will be performant or not.
    There're a lot of tools that will help you out. Have a look at this article from Julie Lerman where she lists several different ways to do profiling. One simple solution is to start profiling in your SQL Server Management Studio.
    Do not hesitate to talk with a DBA (if you have on near you) that will help you to understand the execution plan.
    You could also have a look a this presentation where I wrote a section about loading data and performance.

提交回复
热议问题