2

I have application developed in Visual Studio 2010, .NET 4.0, using MySql database.

I have installed Entity Framework 5.0 and EF 5.x DbContext Generator for VB (using NuGet), then MySql Connector 6.5.5. I'm using Model First approach, so I created two tables, then I chose "Generate database from model.." option. After setting connection provider and connection parameters (with successful test connection to database), I clicked "Finish", and *.sql file was generated but nothing was created in my database. Worse still, the generated SQL script is in SQL Server Flavour and it has a header:

-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/22/2013 12:11:00
-- Generated from EDMX file: C:\Apps\app\DataAccessLayer\DbModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [MyDatabase];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

(...)

How to enforce EF with Mysql and MySql Connector to automatically create database tables, and to generate MySql script, no SQL Server script?

Best regards, WP

sgnsajgon
  • 664
  • 2
  • 13
  • 56
  • I have changed "DDL Generation Template" to "SSDLToMySQL.tt (VS)", and the proper SQL script flavor is generated. But database was not created automatically. Maybe permissions - I will check... – sgnsajgon Mar 22 '13 at 12:11
  • 2
    Database is not generated automatically. You must execute the generated script yourselves. – Ladislav Mrnka Mar 22 '13 at 15:03

1 Answers1

2

Question comments give us and answer. Summary:

1) Change DDL Generation Template property of the *.edmx model to SSDLToMySQL.tt (VS)

2) Database is not generated automatically. You must execute the generated script yourselves (In Visual Studio in Server Explorer view, or using other tools, i.e PhpMyAdmin).

sgnsajgon
  • 664
  • 2
  • 13
  • 56