It is not possible to implicitly convert the type System.Data.Entity.Core.Objects.ObjectResult to System.Data.Objects.ObjectResult

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.

+6
source share
5 answers

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

Right-click the project and select Manage NuGet Packages... On the Online tab, select EntityFramework and click Install Note. If you installed a previous version of the EntityFramework NuGet package, this will upgrade it to EF6. Alternatively, you can run the following command in the package manager console:

 PM> Install-Package EntityFramework 

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

0
source

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

In the end, I realized that the problem lies between the keyboard and the chair. The stored procedure completed with select, but I tried:

 MyStoredProc_Result r = dbcontext.MyStoredPoc(); 

Instead

 MyStoredProc_Result r = dbcontext.MyStoredPoc().FirstOrDefault(); 
+16
source

Open the context.tt file in XML mode and change

 using System.Data.Objects; 

to

 using System.Data.Entity.Core.Objects; 
+9
source

Use VS 2013 or download the new Entity Framework 6 Tools for Visual Studio 2012 .

0
source

You need to change "using System.Data.Objects" to "using System.Data.Entity.Core.Objects"

0
source

Source: https://habr.com/ru/post/972337/


All Articles