VS2017+MySQL+EF6

  1. Uninstall/remove "Connector/NET" and "MySQL for Visual Studio" if installed.

  2. Install "MySQL for Visual Studio" v2.0.5 CTP (MySQL for Visual Studio). Note: Install MySQL for Visual Studio before Connector/NET.

  3. Install "Connector/NET" v6.9.10 (Connector/Net). https://i.stack.imgur.com/XOT1I.jpg Note: I tried using Connector/NET v6.8, v6.10 and v8 first, but none of them worked with Visual Studio 2017 and ADO.Net. Here you can find all Connector Versions and Compatibilities with Visual Studio IDEs, but so far this list is inaccurate.

  4. Create new Visual Studio Professional 2017 project.

  5. Download and Install "EntityFramework" v6.2.0 through NuGet, by going to Project Tab/Manage NuGet Packages/Browse -> Entity Framework.

  6. Add references to C:\Program Files (x86)\MySQL\Connector.NET 6.9.10\Assemblies\v4.5\MySql.Data.dll and C:\Program Files (x86)\MySQL\Connector.NET 6.9.10\Assemblies\v4.5\MySql.Data.Entity.EF6.dll; by Right Clicking over References inside Solution Explorer and selecting Add Reference/Browse ->Browse button.

  7. Add MySQL EF6 provider info inside App.config under entity framework providers as follow:

 

<entityFramework>
       <providers>
         <provider invariantName="MySql.Data.MySqlClient"
              type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
       </providers>
</entityFramework>

 

  1. Rebuild project by going to Build tab/Rebuild ProjectName.

And that's it. VS2017 is ready to go. Hope this works for everybody, as it did for me today.

use <<数据库名称>>;
set global optimizer_switch='derived_merge=OFF';

 

 

引自 https://stackoverflow.com/questions/28241500/cant-create-entity-data-model-using-mysql-and-ef6/38619052#38619052

 

转载于:https://www.cnblogs.com/wangshuming/p/8254175.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值