You can add a code generation item for a DbContext
. Right-click on the design surface of the edmx and choose "Add code generation item" and select DbContext Generator from the Add New Item dialog (you may have to look in online templates). This will create a t4 template that generates a DbContext
.
If you want to keep working with the ObjectContext
API, but sometimes want to switch to DbContext
you can create a DbContext
with the constructor accepting an ObjectContext
as parameter.