The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' could not be loaded

.net entity-framework wcf winforms

Accepted Answer

By adding entity framework to the WCF host site, I was able to resolve problem.

It succeeded.

2
9/30/2015 6:23:53 AM

Popular Answer

Because the client application connects to WCF Services and is unaware of the existence of a database or data access layer, you do not need to install NuGet package for EF6 in the client application.

This mistake is caused by a deficiency inEntityFramework.SqlServer.dll in the host project's or service library's bin folder.

Choice 1

The simplest method is to install EF6 using NuGet Package Manager in your WCF Host project as well; if it has already been installed, try removing and reinstalling it. So as toEntityFramework.SqlServer.dll to generate directories

Please be aware that this approach may be in conflict with the n-layered requirements since your libraries above the data access layer are dependant on the less-than-ideal EF6.

Choice 2

To copy as a workaroundEntityFramework.SqlServer.dll Make sure output directories areCopy Local dll is configured totrue Afterward, add the following code to your DbContext constructor:

var ensureDllIsCopied = System.Data.Entity.SqlServer.SqlProviderServices.Instance; 

It guaranteesEntityFramework.SqlServer.dll is copied to the output directory of the data access project's consumers. This is an alternative.

By doing it this manner, the layers above the data access layer are not dependent on EF.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow