When instantiating EntityFramework’s DbContext in MVC3, does the whole database get read? When debugging, it is possible to access all of the data in the entire database by looking at the instantiated DbContext so wouldn’t this imply that all the data is grabbed when the first connection is made?
When instantiating EntityFramework’s DbContext in MVC3, does the whole database get read? When debugging,
Share
No definitly not. The data is loaded, when you access the DbSet/ObjectSet properties of your DbContext.
Only the data you query for is loaded from the db and mapped to objects. For example, when you query like
Its translated to SQL, evaluated at the database and only the rows that match your query are returned to your app.