The DbContext Generator replaces the ObjectContext with much simpler and shorter code to connect Entity objects to database objects. A single database table with 30 fields is represented by about 800 lines of code as an ObjectContext but about 40 lines of easy to understand code as a DbContext and class generated by the DbContextGenerator.
The DbContext Generator creates two files –
-
creating the DbContext with connection string details and a DbSet for each table.
-
creating the class representing each table. If you open these .tt folders you will see the DbContext and classes generated. You don’t need to do anything with these classes – you refer to them in the Controller actions.
A walkthrough is available at http://msdn.microsoft.com/en-US/data/jj206878