Reputation: 64923
I'd like to know if Entity Framework System.Data.Entity.DbContext
gets configured each time it's instantiated.
Why I got this question?
For example, if you're doing manual mappings overriding DbContext.OnModelCreating(...)
method, it seems that this is going to be called each time a DbContext
is instantiated.
Does Entity Framework perform some kind of configuration caching or whatever?
Upvotes: 1
Views: 357
Reputation: 32437
The configured model is cached.
The EDM used by Code First for a particular context type is cached in the app-domain as an instance of DbCompiledModel.
See Code First: Inside DbContext Initialization for more info
Upvotes: 3