I have an MVC 5 application that I first configured to use Mysql but now would like it to use SQL Server.
My app uses code first and migrations in order to generate the database.
After I changed all the required configuration I tried to run a Update-Database from the Package management console but I keep getting this error:
System.Data.Entity.Core.MetadataException: Schema specified is not
valid. Errors: (0,0) : error 0152: No Entity Framework provider found
for the ADO.NET provider with invariant name 'MySql.Data.MySqlClient'.
Make sure the provider is registered in the 'entityFramework' section
of the application config file. See
http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
You need to follow the below mentioned steps to overcome above issue.
Step 1 : Use
NuGet package to
install the relevant packages.This is very important.
If it's not working after the above step then you have to follow the below mentioned steps.
Step 1 : Get a backup of your
SQL db and keep it in a safe place.
Step 2 : After that you have to
delete all your
data migration scripts on your app.
Step 3 : Delete the
SQL db also.
Step 4 : Recreate all your
Migration scripts again and after that run those against the
Note : You need to do above steps b'cos it seems
EF keep the
provider details on the
db migration scripts.