4
votes

on running following command

pm> Update-Database

getting following error

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'System.Data.Entity.SqlServer.SqlProviderServices' threw an exception. ---> System.TypeLoadException: Method 'ExecuteAsync' in type 'System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy' from assembly 'EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' does not have an implementation.

5
Do all projects in your solution refer to the same Entity Framework version? Did you do a clean and full rebuild? What caused this error, did it work before and did you change anything?CodeCaster

5 Answers

5
votes

Your EF version and Project Version is not Equal. your Entity Framework is ver 6 of .Net 4 but your project use .net 4.5 Project by .net version 4.5 must use EF for .Net4.5

2
votes

I had the same problem (EF 6.1.3 & net462) and I tried all the answers, but nothing fixed the problem. When I eventually switched to Release configuration, it worked liek a charm.

Not sure what's wrong with Debug, since they are almost identically, except for debug trace etc.

Hope this helps other people in the future.

1
votes

Not the ideal solution, but I switched back to Entity Framework 5.0.0 and the problem went away. Found this useful link.

1
votes

Hi I had a similar problem. After a long time I found that one project referenced Entity Framework version 6.1.1 and in another project version 6.1.3 is referenced in same solution. I removed 6.1.3 from the package manager console. Problem is finally solved.

Hope this will help someone

0
votes

I had the same problem. After spending some hours to fix this. What fixed the problem was: I closed the project, created a new one with the same name, copied my folders and classes I created to the new project and downloaded the packages I needed through nuget. Then Add-Migration ...... everything went well afterwards.