title: ASP.NET MVC Update Model and Stored Procedure
body: <p>I am relatively new to ASP.NET MVC, but I have worked with code-first migrations on some basic tables. </p>
  
  <p>My model is as follows</p>
  
  <pre><code>public class sp_Result {    
      [Key]
      public string RowDesc { get; set; }
      public string rowkey { get; set; }
      public int rowlevel { get; set; }
      public int Plan { get; set; }
  }
  </code></pre>
  
  <p>And this is generated by a stored procedure in my controller</p>
  
  <pre><code>public ActionResult StaffPage()
  {
      var startlevel = new SqlParameter("rlevel",10);            
  
      var staffing = db.Database.SqlQuery&lt;sp_Result&gt;("exec sp_MyStoredProcedure @rlevel", startlevel);
      return View(staffing);
  }
  </code></pre>
  
  <p>So I needed to add the field "Plan" and updated my model and stored procedure that generates this info accordingly. However, now I am getting the lovely "The model backing the ' context has changed since the database was created" error. Is there a way to get these to sync, as I am not really looking to update a table, so I'm not entirely sure Code-first is the way to go? I saw here <a href="https://stackoverflow.com/questions/28507636/if-change-model-class-in-dbcontext-do-i-rebuild-the-database" title="Here">https://stackoverflow.com/questions/28507636/if-change-model-class-in-dbcontext-do-i-rebuild-the-database</a> that I can delete the _MigrationHistory table and that would make it work, but I am hesitant to do that.</p>
  
  <p>I should add that this is a non-local database (if that matters). Is there a way to sync my model to my stored procedure output?</p>