On your EDMX design surface, right-click and select Add Code-Generation Item :

Select ADO.NET DbContext Generator from the online gallery:

This adds two T4 template files ( *.tt ) in your solution explorer and generates DbContext and entity classes for you:

And this is the resulting class derived from DbContext for your own project:

source share