Exception when generating Controller with Entity Framework

Asked

Viewed 245 times

3

In my application using Asp.net mvc, with Entity Framework 6, with Mysql, when trying to add the Controllers, with Views, using EPH, I have the following error:

inserir a descrição da imagem aqui

Settings of my web config.:

<connectionStrings>
    <add name="MyEntities" connectionString="metadata=res://*/Models.Model.csdl|res://*/Models.Model.ssdl|res://*/Models.Model.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=MeuServer;user id=MeuUsuario;password=******;persistsecurityinfo=True;database=MeuDatabase&quot;" providerName="MySql.Data.MySqlClient"/>

  </connectionStrings>
  <entityFramework>
    <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6"/>
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6"/>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
    </providers>
  </entityFramework>

How can I solve this problem? Thank you.

NOTE

When trying to create a controller unused EPH, and add the Views manually, using template same error occurs.

  • 1

    I’m not sure, but try commenting on this line: <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>

  • Had already tried this, and did not solve, I noticed that the error occurs during scaffolding.

  • Well, you have a way of putting this project in a version control so I can take a look?

1 answer

1


Generating from scaffolding tries to remove last part that selects the Data Conext connection and scaffolding from a model not directly from the entity.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.