1

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
  • visual studio is a bit finicky about where it looks for .config files. Have you rebuilt your project to ensure you don't have any old .config files for visual studio to find?
    – Claies
    Sep 2, 2014 at 15:30

1 Answer 1

1

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{}

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.