Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This question and answer has been very useful for me migrating a larger EF project from SQL to mySQL so I thought I would add my notes and hope they are useful:</p> <p>As noted the name of the connection string has to match the name of the Class which extends the System.Data.Entity.DbContext.</p> <p>There seems still no way to create tables in EF using the mySQL connector but you can use and modify the SQL create scripts to generate the mySQL tables. The easiest way I found to do this was to comment in and out the OnModelCreating function on the extended DbContext depending on whether the code was needed to recreate tables. If I find I am doing this more often I plan to resolve this by using dependency injection and have seperate classes based on either a mySQL or MSSQL configuration.</p> <p>I found it easier to make sure that the dev boxes and servers had the correct mySQL connector .dll packaged in the release than mess with the DbFactoryProviders in the webconfig. Getting the packaging correct in the project/solution build package meant I only needed the connection string lines and not the DbFactoryProviders lines which I found to be difficult to work consistently across a number of machines.</p> <p>I needed to change the mySQL Identifier Case Sensitivity from the setting I had of 0 to 1. Without this setting the SQL that EF connected could not find the tables that were there due to the mixed case names of my objects compared to the fixed case tables that mySQL creates.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload