У меня есть следующий код в Web.config:
<entityFramework>
<!--<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />-->
<defaultConnectionFactory type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />
<providers>
<!--<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />-->
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
<connectionStrings>
<!--<add name="EFDbContext" connectionString="Data Source=LocalPC\SQLEXPRESS; Initial Catalog=testDB; Integrated Security=true" providerName="System.Data.SqlClient" />-->
<add name="EFDbContext" connectionString="server=localhost; database=testDB; user id=root; password=test" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
Однако, в этой строке в коде:
readonly EFDbContext context = new EFDbContext();
Я получаю следующую ошибку:
> System.InvalidOperationException: 'The Entity Framework provider type
> 'MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6'
> registered in the application config file for the ADO.NET provider
> with invariant name 'MySql.Data.MySqlClient' could not be loaded. Make
> sure that the assembly-qualified name is used and that the assembly is
> available to the running application. See
> http://go.microsoft.com/fwlink/?LinkId=260882 for more information.'
Я установил MySql.Data и MySql.Data.Entity
Может кто-нибудь помочь мне решить эту проблему?