In Visual Studio, go to SolutionExplorer, then click on Project; you will be adding the model Right mouse. Choose ADO.NET EntityDataModel.
Then choose Generate from the database and click Next; in the next window, click New Connection and point to the database you want to generate the model from (Could be MSSQL, MYSQL, or Oracle)
After doing this, click on Test Connection to see if you have configured the connection properly (do not go any further if it fails here).
Click Next, then choose options you want (like style for generating entity names or adding foreign keys).
Click Next again; you should have the model generated from the database.
In the T4 code-generation strategy used by Entity Framework 5 and higher, data annotation attributes are not included by default. To have data annotations on top of a particular property for every model regeneration, open the template file included with EDMX(with .tt extension), and add a using statement under the UsingDirectives method.
|