MySQL with Entity Framework - what am I doing wrong?

前端 未结 5 374
醉酒成梦
醉酒成梦 2021-01-12 08:49

I am completely new to Entity Framework and even ADO.NET in general (don\'t typically do much work with databases).

  1. I downloaded and installed MySQL Connector/
相关标签:
5条回答
  • 2021-01-12 09:38

    Well, I don't know if this is the way it's supposed to be or not (if it is, I'm a little embarrassed -- though in my defense I fail to see anywhere this is clearly indicated); but it seems the problem was that I had my target framework set to .NET 3.5. After changing my project's target framework (honestly, on a whim) to .NET 4.0, the NullReferenceException went away.

    So, as unsatisfying as it may be, that seems to have been the solution in my case.

    0 讨论(0)
  • 2021-01-12 09:43

    I got past this error by adding a reference to MySql.Data.Entity.dll (and MySql.Web.dll)

    0 讨论(0)
  • 2021-01-12 09:43

    In the MySqlClientFactory-> MySqlDbProviderServicesInstance property. It reference the ass:MySql.Data.Entity use the code

    string str = Assembly.GetExecutingAssembly().FullName.Replace("MySql.Data", "MySql.Data.Entity");

    But in the MySql Client 6.3.5 the MySqlData's version is 6.3.5, and MySql.Data.Entity's version is 6.3.4(in \Program Files\MySQL\MySQL Connector Net 6.3.5\Assemblies\v2.0).so it can't load it successfully.

    In the folder(\Program Files\MySQL\MySQL Connector Net 6.3.5\Assemblies\v4.0) ,the MySql.Data.Entity's version is 6.3.5,so itcan load successed.

    So the one way is change the target to .NET 4.0,and another is roll the MySql.Data back to 6.3.2/6.1.2 .

    0 讨论(0)
  • 2021-01-12 09:46

    That's a provider bug. It may be a bug which is triggered by a configuration error, but it is a provider bug nonetheless. You should talk to the people who wrote your MySQL provider, and send them that stack and test case.

    0 讨论(0)
  • 2021-01-12 09:53

    Good news ! This issue has been solved in MySQL Connector/NET 6.3.6 Update your MySql Connector to solved the problem.

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