ef power tools mysql_实体框架Powertools用Mysql和EF6生成视图

bd96500e110b49cbb3cd949968f18be7.png

I am using Entity Framework 6.1 with MySQL Server 5.5.35, and EF Powertools (latest version). I am able to run and use the framework fine and registered all the correct provider details in the application configuration file.

Where I am having an issue is that I cannot use the right click Power tool function Generate Views, it keeps throwing up this exception:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.Entity.Core.MetadataException: Schema specified is not valid. Errors:

Model1.edmx(7,8) : 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.

I understand what is asking because I struggled with this issue when running my project originally, but although it works fine when running and compiling the generate views function throws this error. I can only assume that the Power tools is looking for the providers in another location and not my Application Configuration file as they are registered their.

Does anyone have any ideas on where it may get the providers list, maybe from the global system config file? I am not really experienced with that and after searching for hours have come up with nothing.

Any help would be appreciated or pointing in right direction.

Thanks

解决方案

First reason, try using a lower version of Entity Framework. When i used MySql, EF6 didn't support Mysql at this time. It's apparently avalaible now for 6.0 if you have the connector 6.8.x but i'm still not sure about 6.1.

You can see the infos here : EF6.0 connector

Several reasons might leads to that :

Are you sure to have a section like this in your App.config or Web.config ?:

I also had to add the following code when i worked with MySql, don't know why because i don't have to when i work with SQL Server ...

[DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]

public class DemoContext : DbContext{}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值