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

后端 未结 5 1840
感动是毒
感动是毒 2021-02-14 15:30

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

5条回答
  •  甜味超标
    2021-02-14 16:03

    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();
    

提交回复
热议问题