title: Database changes do not persist after ObjectContext.SaveChanges() is called
body: <p>I am trying to insert a record into a table using an Entity Framework. I made my database (mdf file), made a model from the database (edmx), and now I am trying to insert a record.</p>
  
  <pre><code>Users Brad = new Users
  {
      UserInitials="BCH",
      UserName="Brad"
  };
  using (WeighProgramDatabaseEntities wDB = new WeighProgramDatabaseEntities())
  {
      wDB.Users.AddObject(Brad);
  
      int res = wDB.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave);
      List&lt;Users&gt; lwt = wDB.Users.ToList();  //call to look at the inserted data
  }
  </code></pre>
  
  <p>When I follow this procedure it appears everything works fine. My <code>wDB.Users.ToList();</code> returns one record which is the one I just inserted. However, if I run my code again, removing the insert stuff and just call the query (leaving just) <code>List&lt;Users&gt; lwt = wDB.Users.ToList();</code> my query returns no records. What should I be doing differently to get my changes to persist? Why did my records "go away"?</p>
  
  <p><code>WeighProgramDatabaseEntities</code> inherits from <code>ObjectContext</code>.</p>
  
  <p>This is my first attempt at using EF stuff so some of my verbiage might not be correct and I might not have included something important - let me know.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I think my problem is that my Insert/Update/Delete functions are not mapped. But I'm not sure how to create a stored procedure for them to map to...</p>
  
  <p><strong>Edit2:</strong></p>
  
  <p>Ok, phew, I figured out the stored procedure mapping. and now that I have an INSERT mapped, and I call <code>AddObject</code> it will actually be inserted. </p>
  
  <p>A little more complicated than I would have expected. For example if I right click on a table in my Database Explorer and select New Query it brings me to a great query designer window which let's me create Inserts, Selects, Updates... but there is no Save button! It's grey out. I need to write them from another route with does not let me generate Inserts/Deletes/Updates via a GUI. Which is ok I guess because they are not much text, but still a bit of a hassle.</p>