Entity Framework using the wrong connection provider

前端 未结 4 1237
时光取名叫无心
时光取名叫无心 2021-01-05 17:21

I am trying to use Entity Framework 5 (code-first) for an ASP.NET Web Forms application, I have previously had a basic implementation running using the MySQL connection and

相关标签:
4条回答
  • 2021-01-05 17:36

    Questions is old, but may be this will be helpful for somebody.

    I've got the same issue with transition from Oracle to MS SQL Server. Eventually, it appeared that code migrations were the root cause of the issue. You cannot just leave them as is after switching to another database provider. So, you must REGENERATE migrations for your new database provider.

    0 讨论(0)
  • 2021-01-05 17:43

    I had the same issue recently, There is an issue in your App.config file. Just recreate it and it will work. (Create an black project and copy its default app.config and replace it). Then re-install the nuget packages.

    All the best.

    0 讨论(0)
  • 2021-01-05 17:43

    None of the answers above solved the problem for me. I ended up creating a new solution and copied all the source (except web.config and Migrations) over and it worked.

    0 讨论(0)
  • 2021-01-05 17:46

    I had the same issue with a different resolution, so I'll go ahead and post it here for the next person who searches.

    I had my connection string listed where it could be found in the web config in the <connectionStrings></connnectionStrings> section. It seemed to be reading the connection string, but not the providerName.

    I looked at it for a long time before realizing that I had needlessly put it inside the <runtime></runtime> section.

    When I put my <connectionStrings> back in the root of <configuration>, Entity Framework started using the right provider again.

    0 讨论(0)
提交回复
热议问题