Aug 28, 2016 01:34 AM|Yohann Lu|LINK
I am trying to find a better way to load big complex models using the entity framework
You may consider using some caching in the Entity Framework.
1.Object caching – the ObjectStateManager built into an ObjectContext instance keeps track in memory of the objects that have been retrieved using that instance. This is also known as first-level cache.
By default when an entity is returned in the results of a query, just before EF materializes it, the ObjectContext will check if an entity with the same key has already been loaded into its ObjectStateManager. If an entity with the same keys is already present
EF will include it in the results of the query. Although EF will still issue the query against the database, this behavior can bypass much of the cost of materializing the entity multiple times.
2.Query Plan Caching - reusing the generated store command when a query is executed more than once.
The first time a query is executed, it goes through the internal plan compiler to translate the conceptual query into the store command. If query plan caching is enabled, the next time the query is executed the store command is retrieved directly from the
query plan cache for execution, bypassing the plan compiler.
With results caching (also known as "second-level caching"), you keep the results of queries in a local cache. When issuing a query, you first see if the results are available locally before you query.