Victor's Blog

Live as if you were to die tomorrow. Learn as if you were to live forever

NAVIGATION - SEARCH

Weird exception in EF6 unit test

I am using Effort to perform my data access layer unit test. It worked fine until I upgraded my entity framework to version 6. Then I got this wired exception:

"The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application"

I googled this exception. A lot of people thought this was caused by the EF dlls were not deployed at part of the test. But this didn't resolve the issue for me. So I decided to comment out the provider section in app.config for the unit test project and try my luck.

<providers>
     <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />    
</providers>

Guess what, everything is back to normal agin. Sounds stupid, but it works:D

blog comments powered by Disqus