Cannot implicitly convert type System.Data.Entity.Core.Objects.ObjectResult to System.Data.Objects.ObjectResult

c# entity-framework

Question

I am trying to update an EDMX Stored Procedure and I am getting this error:

Cannot implicitly convert type System.Data.Entity.Core.Objects.ObjectResult<X> to System.Data.Objects.ObjectResult<X>

I am using Visual Studio 2012.

1
8
7/16/2014 4:39:13 PM

Accepted Answer

You need to upgrade to the new Entity Framework 6 runtime.

Right-click on your project and select Manage NuGet Packages... Under the Online tab select EntityFramework and click Install Note: If a previous version of the EntityFramework NuGet package was installed this will upgrade it to EF6. Alternatively, you can run the following command from Package Manager Console:

PM> Install-Package EntityFramework

Reference: http://msdn.microsoft.com/en-US/data/upgradeEF6

0
3/30/2016 4:32:38 PM

Popular Answer

I had the error and none of these solutions worked (I was already using System.Data.Entity.Core.Objects, it was also in the context.tt, etc).

I eventually realised the problem lay between the keyboard and the chair. The stored proc finished with a select, but I was trying:

MyStoredProc_Result r = dbcontext.MyStoredPoc();

Instead of

MyStoredProc_Result r = dbcontext.MyStoredPoc().FirstOrDefault();


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