Click here to Skip to main content
15,439,373 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Our application uses code first database based on entity framework 5.0. the model contains about 100 types which map to about 70 tables with a couple of thousand records all together.
we require to load most of the data at application startup. for his purpose we simply call Dbset<>.Load() to load all records.

the loading time seemed very long which led us to do some improvements such as pre generated views, unite types and remove redundancies.

after the above we used a profiler to check where all the time is wasted, and saw that less than 10% of the loading time is used for SQL and about 70% is used for Activator.CreateInstance() (this use is understandable since entity framework does not "know" our entity types).

we then tried to use Include() to load only required data, however this multiplied the loading time (from what i read because .Include() is good for 1-2 properties), and clearly does not serve our purpose.

is this the limitation of entity framework or there are other ways to improve performance?

1 solution

Check this tutorial:

Entity Framework for Beginners[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900