This tutorial demonstrates how to create MySQL DDL from an Entity Framework model. Minimally, you will need Microsoft Visual Studio 2017 and MySQL Connector/NET 6.10 to perform this tutorial.
Create a new console application in Visual Studio 2017.
Using the Solution Explorer, add a reference to
MySql.Data.Entity
.From the Solution Explorer select , . In the Add New Item dialog select Online Templates. Select ADO.NET Entity Data Model and click to open the Entity Data Model dialog.
In the Entity Data Model dialog select Empty Model. Click to create a blank model.
Create a simple model. A single Entity will do for the purposes of this tutorial.
In the Properties panel select from the drop-down list.
In the Properties panel, locate the DDL Generation Template in the category Database Script Generation.
For the DDL Generation property select from the drop-down list.
Save the solution.
Right-click an empty space in the model design area to open the context-sensitive menu. From the menu select Generate Database Wizard dialog.
to open theIn the Generate Database Wizard dialog select an existing connection, or create a new connection to a server. Select an appropriate option to show or hide sensitive data. For the purposes of this tutorial, you can select Yes, although you might skip this for commercial applications.
Click
to generate MySQL compatible DDL code and then click to exit the wizard.
You have seen how to create MySQL DDL code from an Entity Framework model.