Мы используем EntityFramework 6 с кодом First. У нас есть консольное приложение, которое не имеет ссылки на EntityFramework, но читает строку подключения из App.config. Он вызывает сборку DatabaseInitializationUtilities, передающую строку соединения в качестве параметра.Поставщик ADO.NET не найден провайдер Entity Framework с инвариантным именем «System.Data.SqlClient».
DatabaseInitializationUtilities имеет ссылку на EF6 (EntityFramework и EntityFramework.SqlServer). Его 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>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IAuthentication" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/SecurityServices/Authentication.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAuthentication" contract="SecurityService.IAuthentication" name="BasicHttpBinding_IAuthentication" />
</client>
</system.serviceModel>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
Когда выполнение достигает линии, где DatabaseInitializationUtilities пытается запустить сценарий
context.Database.ExecuteSqlCommand(script.ScriptText)
брошена ошибка:
Нет Entity Framework поставщик найдено для поставщик ADO.NET с инвариантным именем «System.Data.SqlClient». Убедитесь, что провайдер зарегистрирован в разделе «entityFramework» файла конфигурации приложения. См. http://go.microsoft.com/fwlink/?LinkId=260882 для получения дополнительной информации.
Я считаю, что это именно то, что у меня есть в файле конфигурации, поэтому я не понимаю проблему.
ПРИМЕЧАНИЕ.. Resharper является bluelining узел и отчетности «Элемент„EntityFramework“имеет„провайдеры“недопустимый дочерний элемент Однако участок был впрыскивается NuGet, когда я установил Ef6
Любые идеи
?
Взгляните на следующий вопрос: http://stackoverflow.com/questions/14033193/entity-framework-provider-type-can-not-be-loaded – Lloyd
Спасибо. Комментарий к [http://stackoverflow.com/questions/14033193/entity-framework-provider-type-could-not-be-loaded][1] был полезен. [1]: http://stackoverflow.com/questions/14033193/entity-framework-provider-type-could-not-be-loaded – Dewey
Добавить EntityFramework.SqlServer.dll к клиентскому приложению и добавить connectionstrings в файл app.config сделал трюк. Теперь ошибка исчезла http://stackoverflow.com/questions/18455747/no-entity-framework-provider-found-for-the-ado-net-provider-with-invariant-name –