Entity Framework Powertools Generating Views with Mysql and EF6

c# ef-power-tools entity-framework-6 mysql

Question

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

1
0
9/2/2014 3:18:21 PM

Popular Answer

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 ?:

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

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
9/2/2014 3:44:51 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow