3

I'm getting the below error with EF 5 and have researched it on the web vigorously and figured it was simply a mapping issue. Everything I have checked into comes out fine.

Can someone please possibly inform me what the error might be based on the below info???

The data reader is incompatible with the specified 'VisionModel.sSRPTFundexDocCodes1_Test_Result'. A member of the type, 'NumEmployeesatApp1', does not have a corresponding column in the data reader with the same name.

When I debug the below code snippet, right after that is when I get the above error.

return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sSRPTFundexDocCodes1_Test_Result>("sSRPTFundexDocCodes1_Test", subscriberIDParameter, applicationNumParameter);

The parameters going into the stored procedure are OK.

The mapping is just fine. On the left hand side of the mapping is: NumEmployeesatApp and the right hand side is exactly the same.

I completely deleted my EDMX file and created it from scratch with the same error occurring. When I do a "Get column info" from the function, the column name comes out to what is exactly in the above stored procedure.

The template that is generated off of the EDMX file (Vision) and the stored procedure above have the columns matching exactly.

btw, I'm able to run other INSERT & SELECT LINQ queries off of the EF 5 model I have with no problem.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
sagesky36
  • 4,542
  • 19
  • 82
  • 130
  • I ran the sproc outside of the application and it returns 3 records... This has me bewildered.. I don't know what else I can do... – sagesky36 Oct 04 '12 at 00:13
  • Are the names of the columns returned by the sproc correct - do you have NumEmployeesatApp1 column in the resultset returned by the sproc or the mapping that tells EF what name of the column to expect for NumEployeessatApp1 property? – Pawel Oct 04 '12 at 02:20
  • This is the part where I would LOVE to go into the snippet I posted above and actually see EF process the request (similiar to going into a typed dataset generated code and seeing what command & columns are there. The snippet is "return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sSRPTFundexDocCodes1_Test", subscriberIDParameter, applicationNumParameter);" However, once I get to that point and try and step into it, I can't. – sagesky36 Oct 04 '12 at 12:29
  • I double checked my debugging options and I have the "Enable just my code" in the Debugging options unchecked where I should be able to step into the generated code. If I am able to get in here, I'm sure I'll be able to see what's going on... Any help onn this would be much appreciated.... – sagesky36 Oct 04 '12 at 12:32
  • EF5 code is not open source. Even if you use public symbols you probably won't be able to step through the code since there is no sources available. Also, you would not see a whole lot since the code would be optimized and you would not be able to see any but some local variables. What you can do however is to use Sql Profiler to see what EF sends to the database (you may also be able to see it with IntelliTrace). Try to execute the exact command EF sends to Sql query and see the results. Update your question with results and the snippet that shows how you mapped your stored proc in MSL&CSDL – Pawel Oct 04 '12 at 17:50

1 Answers1

4

I had the same issue if you are using the stored procedure with an output parameter you need to mark the return type as NONE in function import. This is weird but it works.