找不到具有不变名称“MySql.Data.MySqlClient”的ADO.NET提供程序的实体框架提供程序。同时产生视图 [英] No Entity Framework provider found for the ADO.NET provider with invariant name 'MySql.Data.MySqlClient'. while generating views

查看:117
本文介绍了找不到具有不变名称“MySql.Data.MySqlClient”的ADO.NET提供程序的实体框架提供程序。同时产生视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误,同时为我的EF6项目生成视图,我查看了与其他相似的错误相关的stackoverflow文章,并相应地更新了我的app.config,我添加了 MySql.Data.Entity。 EF6作为提供者,也为我的EF项目添加了参考,完全失去了我的问题,任何人都可以提供有关问题或调试方式的信息?

I am getting the following error while generating views for my EF6 project,I looked at other stackoverflow posts related to similar error and updated my app.config accordingly ,I added the MySql.Data.Entity.EF6 as provider and also added a reference for my EF project,am completely lost as to what my issue is?can anyone provide info on what the issue is or how to debug this?

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.Entity.Core.MetadataException: Schema specified is not valid. Errors: 
BitDatabaseModel.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. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
   at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Loader.ThrowOnNonWarningErrors()
   at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Loader.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths)
   at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Loader..ctor(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, Boolean throwOnError, IDbDependencyResolver resolver)
   at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Init(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean throwOnError, IDbDependencyResolver resolver, DbProviderManifest& providerManifest, DbProviderFactory& providerFactory, String& providerInvariantName, String& providerManifestToken, Memoizer`2& cachedCTypeFunction)
   at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection..ctor(IEnumerable`1 xmlReaders)

App.config

App.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
    <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider></providers>
  </entityFramework>
  <connectionStrings>
    <add name="BitDatabaseEntities" connectionString="metadata=res://*/BitDatabaseModel.csdl|res://*/BitDatabaseModel.ssdl|res://*/BitDatabaseModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=xx.xx.xxx.xxx;user id=username;password=passwordname;persistsecurityinfo=True;database=aci_dev&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
<system.data>
    <DbProviderFactories>
      <remove name="MySQL Data Provider" 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.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /></DbProviderFactories>
</system.data></configuration>

项目参考;

推荐答案

这是在添加以下web.config

This was solved after adding following to web.config

  <entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">

这篇关于找不到具有不变名称“MySql.Data.MySqlClient”的ADO.NET提供程序的实体框架提供程序。同时产生视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆