0

So, I am working on an already existing application. The application has implemented a DB first approach. I recently updated a stored procedure. I updated the same stored procedure in the EDMX file, using the model browser.

Lets call the SP as "GetData"

The SP is nothing but a set of select statements executed one after another.

Now, there was already an existing FunctionImport and a complex type for this particular SP.

The function import is not showing a return type for the SP. It looks like this Function Import Returns None

But, the modelContext.cs file autogenerated has a type present there, like this

        public virtual ObjectResult<EMPLOYEEDATA> sp_GetData(Nullable<int> isActive)
        {
        var isActiveParameter = isActive.HasValue ?
            new ObjectParameter("IsActive", isActive) :
            new ObjectParameter("IsActive", typeof(int));

        return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<EMPLOYEEDATA> 
          ("GetData", isActiveParameter);
       }

Entity EMPLOYEEDATA , where is that coming from.Clearly, the function import is not returning anything. Where is that getting set up? I checked the EDMX XML, the result mapping does show EMPLOYEEDATA present there. But, if I now want to add a couple of other mappings to be returned as well, how do I do it?

Where is this mapping happening? I dont see it in the model browser?

AKS
  • 1
  • 3
  • O yes, this has been asked many times. A sproc returning multiple result sets needs special treatment. Look for EDMX + multiple results. – Gert Arnold Jun 03 '22 at 07:09
  • Thanks Gert. I did find the solution. I finally had to manually make changes to the EDMX XML file to accept the new Result mappings. – AKS Jun 03 '22 at 10:08
  • Excellent. If it was a Stack Overflow question that put you in the right track you may want to mark your question as duplicate of it. – Gert Arnold Jun 03 '22 at 10:14
  • It was not a SO question. I just googled your comment and found an exact answer to my query on another website. – AKS Jun 03 '22 at 12:36

0 Answers0