I've added and designed an ADO.NET Entity Data Model (.edmx) and have generated the corresponding DDL Script (.edmx.sql). When I was using SQL Server 2008, all I had to do was connect to it via the Transact-SQL Editor toolbar and execute the SQL. When I try this method, however, it doesn't let me connect to the MySQL server, as it seems to be looking only for Microsoft SQL Servers. I have the latest version of Connector/Net, and can add the MySQL database as a Data Connection, but cannot execute the script I need. What steps are needed to use an Entity Framework model with my MySQL server?
Asked
Active
Viewed 1,165 times
2
-
2Check this topic if it helps: http://stackoverflow.com/questions/76488/using-mysql-with-entity-framework – Ladislav Mrnka Jul 25 '11 at 18:57
-
@Ladislav - That's a very helpful question, but unfortunate everything I see generates the model from the database, and I'm looking to do it the other way around. – dlras2 Jul 25 '11 at 19:31
-
Not every connector supports creating a database from model. – Ladislav Mrnka Jul 25 '11 at 19:36
-
I'm seeing that... unfortunately, that may be the answer to my question. =[ – dlras2 Jul 25 '11 at 19:46
1 Answers
0
I stumbled across this little property while editing my Data Model:
(This option was installed along side Connector/Net.)
After changing to SSDLToMySQL.tt
, right-click and select Generate Database from Model...
as you would normally. This will generate the .edmx.sql
file, and should give you several errors (as .NET uses SQL Server to parse .sql
files.) After generating the DDL script, I opened up MySQL Workbench and pasted the script in. You need to make sure that an appropriately-named schema already exists on the server, then run the script, and voila.

dlras2
- 8,416
- 7
- 51
- 90