title: Entity Framework Best Practices: What layer should call SaveChanges()?
body: <p>For a clean data model, I'm going back and forth on this...</p>
  
  <p>Using an approval workflow as an example, let's say in my web application I have a page that lets a user flag a <code>MyEntityObject</code> for approval. <code>MyEntityObject</code> has a few properties that control its approval workflow, so I have a common utility method out there called <code>FlagForApproval(MyEntityObject eo)</code>.</p>
  
  <p>Should the <strong>page</strong> call <strong>FlagForApproval()</strong> to set necessary properties only and then call <strong>SaveChanges()</strong> when it's ready, or should <strong>FlagForApproval()</strong> save the changes?</p>
  
  <p>Having the utility method save changes seems like it's doing a little more than it's asked to do (what if it was just one step in a series of operations?), but at the same time, making the page call SaveChanges() and commit the data to the DB seems like it could be considered too close to data layer responsibilities.</p>
  
  <p>Thoughts?</p>
  
  <p>(Update: FWIW, so far I have been having utility methods call SaveChanges(), that way the page only has one set of exceptions to handle, whether validation or data.)</p>