I just added a couple fields to my stored procedure, which connects to my MVC app using EF, but the new fields are returning null values, even though the model has been updated and seems fine....
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MyNamesSpace
{
using System;
public partial class MyStoredProcedure_Result
{
public Nullable<int> myfield1 { get; set; }
public string myfield2 { get; set; }
public string myfield3 { get; set; }
public Nullable<int> myfiel14 { get; set; }
public string myNEWFIELD { get; set; } // always returns null
public string test { get; set; } // always returns null
}
}
I've updated SPs many times.
The only thing unusual that happened this time, was that there was a bit of confusion during the process, since I had to remove references to a temp table in order to get it to update the model. (Entity Framework can't handle a simple table variable?) This problem happens now even when my temp table is completely removed from the query.
The strangest thing is that even though THIS test column has been added to the model, it is still returning no data to the added field. An additional "test" field where I hardcoded a value into the query:
Select from mytable
[..other query lines..]
"test" as test
How can the test field return null when I hardcoded a value to it?
EDIT: I went ahead and recreated the entire model which fixed the problem. I'm keeping the old one until I can figure out exactly what the difference is between the two, and will post back when (or, big if) I find out.