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 MySQLDDL 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 theSolution Explorer, add a reference toMySql.Data.Entity.

  3. From theSolution Explorer selectAdd,New Item. In theAdd New Item dialog selectOnline Templates. SelectADO.NET Entity Data Model and clickAdd to open theEntity Data Model dialog.

  4. In theEntity Data Model dialog selectEmpty Model. ClickFinish to create a blank model.

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

  6. In theProperties panel selectConceptualEntityModel from the drop-down list.

  7. In theProperties panel, locate theDDL Generation Template in the categoryDatabase Script Generation.

  8. For theDDL Generation property selectSSDLToMySQL.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 selectGenerate Database from Model to open theGenerate Database Wizard dialog.

  11. In theGenerate 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 selectYes, although you might skip this for commercial applications.

  12. ClickNext to generate MySQL compatible DDL code and then clickFinish to exit the wizard.

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