title: Entity Framework 4.1 DbSet Reload
body: <p>I'm using a single instance of <code>DbContext</code> scenario to shadow entire copy of the database locally in a WPF app. I've heard this is bad practice, but my database is small and I need an entire copy of it locally while the app is running.</p>
  
  <p>An extension method for <code>IQueryable</code>, <code>Load()</code> lets me preload the elements of a <code>DbSet&lt;&gt;</code>, so that I can bind things to the Local property of <code>DbSet&lt;&gt;</code>. Data in the database changes rapidly, so I want to <code>SaveChanges()</code> and reload <strong>everything</strong>, even objects that are already tracked. Calling the <code>Load()</code> method again doesn't update the items that are tracked but are not marked as changed, which are already loaded.</p>
  
  <p>What is the preferred method of reloading the preloaded items in a <code>DbSet&lt;&gt;</code>? Off the top of my head, I can only think of calling <code>SaveChanges()</code>, then go through all entries and set both tracked and original values to the current values in the database, then <code>Load()</code> whatever new objects that might have been added. In my scenario it's not possible to delete objects, but I might have to support item deletion in the long run. This doesn't seem right, there should be a way to drop everything and reload. It would seem that it's easier to drop my context and just start anew, but all the elements in WPF are already bound to the <code>Local´ObservableCollection&lt;&gt;</code>, and this just messes up the interface.</p>