Documentation Home
MySQL Connector/NET Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 1.3Mb
PDF (A4) - 1.3Mb


MySQL Connector/NET Developer Guide  /  Connector/NET Tutorials  /  Tutorial: Generating MySQL DDL from an Entity Framework Model

6.5 Tutorial: Generating MySQL DDL from an Entity Framework Model

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.

  1. Create a new console application in Visual Studio 2017.

  2. Using the Solution Explorer, add a reference to MySql.Data.Entity.

  3. From the Solution Explorer select Add, New Item. In the Add New Item dialog select Online Templates. Select ADO.NET Entity Data Model and click Add to open the Entity Data Model dialog.

  4. In the Entity Data Model dialog select Empty Model. Click Finish to create a blank model.

  5. Create a simple model. A single Entity will do for the purposes of this tutorial.

  6. In the Properties panel select ConceptualEntityModel from the drop-down list.

  7. In the Properties panel, locate the DDL Generation Template in the category Database Script Generation.

  8. For the DDL Generation property select SSDLToMySQL.tt(VS) from the drop-down list.

  9. Save the solution.

  10. Right-click an empty space in the model design area to open the context-sensitive menu. From the menu select Generate Database from Model to open the Generate Database Wizard dialog.

  11. In 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.

  12. Click Next to generate MySQL compatible DDL code and then click Finish to exit the wizard.

You have seen how to create MySQL DDL code from an Entity Framework model.