问题
The error
When it happens
I'm attempting to create a simple controller using a ViewModel as model.
Connection String
<connectionStrings>
<add name="BoaPropostaEntities"
connectionString="metadata=res://*/Models.MyApp.csdl|res://*/Models.MyApp.ssdl|res://*/Models.MyApp.msl;provider=MySql.Data.MySqlClient;provider connection string='server=localhost;user id=root;password=root;persistsecurityinfo=True;database=mydatabase'"
providerName="MySql.Data.MySqlClient"/>
Web.Config spotlight
I also added to Web.Config some settings:
<system.data>
<DbProviderFactories>
<clear />
<add name="MySQL Data Provider"
invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
And:
<entityFramework>
<defaultConnectionFactory type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data"/>
<contexts>
<context type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity"/>
</contexts>
</entityFramework>
All references seems to be okay.
The question
Ideas to resolve my problem?
Environment
Windows 8.1 + Visual Studio 2013 + MVC 4 + MySQL 5.6 + Connector/Net 6.8.3 + MySQL for Visual Studio Plug-In 1.1.0 + Entity Framework 5
What I already tried
- I already tried to go with EF 6 — no scaffolding support then I give it up;
- I already tried to use a lower version of Connector/Net (such as 6.6.x ~ 6.7.x), but I get another problems;
Duplicated?
I already searched in lots of topics about this subject. Unfortunatelly, until now, without success. I'm thinking that my problem is related specifically with my connectionString.
If you want, post the topics related — I can confirm that isn't my solution. Anyway, sorry about one more topic about this, but nothing else is helping me.
回答1:
That's an EF connection string, not a MySQL connection string.
You need providerName="System.Data.EntityClient"
.
来源:https://stackoverflow.com/questions/20794616/keyword-not-supported-metadata-mysql