EF: How to reduce the very first DataContext initialization time

I am using an automatically generated Entity-Framework data model for a database that has over 100 tables. Although I use only 5 tables, I select all the tables to map to C # classes.

Each time I run the dekstop application that creates an instance of the DataContext in the FormLoad event, it takes 3-4 seconds for some internal EF initialization. This start-up time is highly dependent on the number of auto-generated classes. When I decided to create a comparison for only 5 tables, the start time was drastically reduced.

I wonder what happens behind the scenes, and can I change the standard behavior while keeping all unused table mappings in the program? I do not want to care about which tables I need to display. I think that EF makes some thought, can it be in the style of lazy loading or in some form?

Thank you in advance!

+3
source share
1 answer

1 2. , , , . , , , , , .

+3

All Articles