In this tutorial you will learn how to create MySQL DDL from an Entity Framework model. You will need to use Visual Studio 2010 and MySQL Connector/NET 6.3 to carry out this tutorial.
Create a new console application in Visual Studio 2010.
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 . The Entity Data Model dialog will be displayed.
In the Entity Data Model dialog select Empty Model. Click . A blank model will be created.
Create a simple model. A single Entity will do for the purposes of this tutorial.
In the Properties panel select from the drop-down listbox.
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 listbox.
Save the solution.
Right-click an empty space in the model design area. The context-sensitive menu will be displayed.
From the context-sensitive menu select Generate Database Wizard dialog will be displayed.
. TheIn the Generate Database Wizard dialog select an existing connection, or create a new connection to a server. Select an appropriate radio button to show or hide sensitive data. For the purposes of this tutorial you can select Yes (although you may not want to do this for commercial applications).
Click
. MySQL compatible DDL code will be generated. Click to exit the wizard.
You have seen how to create MySQL DDL code from an Entity Framework model.