title: Entity Framework ChangeTracker not updated, returns "deleted" entities
body: <p>I'm successfully deleting entity from SQLite database by datagrid delete row event. This can be confirmed by SQLite Manager. However after running this delete event and <strong>SaveChanges()</strong> command I still get the deleted entities after using <strong>GetLocal()</strong> method.</p>
  
  <p>Here's the deleteRow method (<em>Complete() calls SaveChanges()</em>):</p>
  
  <pre><code>private void dld_PreviewKeyDown(object sender, KeyEventArgs e)
  {
      if (e.Key == Key.Delete &amp;&amp; !_isBeingEdited)
      {
          var grid = (DataGrid)sender;
          if (grid.SelectedItems.Count &gt; 0)
          {
              var res = MessageBox.Show("Are you sure you want to delete " + grid.SelectedItems.Count + " devices?", "Deleting Records", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
              if (res == MessageBoxResult.Yes)
              {
                  foreach (var row in grid.SelectedItems)
                  {
                      Device device = row as Device;
                      _context.Devices.RemoveDevice(device);
                  }
                  _context.Complete();
                  MessageBox.Show(grid.SelectedItems.Count + " Devices have being deleted!");
              }
              else
                  DeviceListDataGrid.ItemsSource = _context.Devices.GetLocal();
          }
      }
  }
  </code></pre>
  
  <p>Next time when loading the entities I get the correct entities, but after running <strong>GetLocal()</strong> I receive the previously deleted entities?</p>
  
  <p>Loading:</p>
  
  <pre><code>    _context.Devices.Load();
      var devices = _context.Devices.GetLocal();
      DeviceListDataGrid.ItemsSource = devices;
  </code></pre>
  
  <p>GetLocal method returns all the previously deleted entities?</p>
  
  <pre><code>public ObservableCollection&lt;TEntity&gt; GetLocal()
  {
      Context.GetService&lt;DbContext&gt;();
      var data = Context.ChangeTracker.Entries&lt;TEntity&gt;().Select(e =&gt; e.Entity);
      var collection = new ObservableCollection&lt;TEntity&gt;(data);
  
      collection.CollectionChanged += (s, e) =&gt;
      {
          if (e.NewItems != null)
          {
              Context.AddRange(e.NewItems.Cast&lt;TEntity&gt;());
          }
  
          if (e.OldItems != null)
          {
              Context.RemoveRange(e.OldItems.Cast&lt;TEntity&gt;());
          }
      };
  
      return collection;
  }
  </code></pre>
  
  <p>For some reason the line <code>var data = Context.ChangeTracker.Entries&lt;TEntity&gt;().Select(e =&gt; e.Entity);</code> still returns the old entities prior deletion?</p>
  
  <p>Here's the device database table:</p>
  
  <pre><code>CREATE TABLE "Device" (
      "DeviceId" INTEGER NOT NULL CONSTRAINT "PK_Device" PRIMARY KEY AUTOINCREMENT,
      "AdditionalInformation" TEXT,
      "Ampere" REAL,
      "Category" TEXT,
      "Category1CategoryId" INTEGER,
      "Description" TEXT,
      "DocumentIdentifier" TEXT,
      "GrossPrice" REAL,
      "HasErrors" INTEGER NOT NULL,
      "IsValid" INTEGER NOT NULL,
      "LeafletPath" TEXT,
      "Location" TEXT,
      "Name" TEXT,
      "NetPrice" REAL,
      "Notes" TEXT,
      "ProductCode" INTEGER NOT NULL,
      "ProductType" TEXT,
      "ProductType1ProductTypeId" INTEGER,
      "Supplier" TEXT,
      "Supplier1SupplierId" INTEGER,
      "TechData" TEXT,
      "TimeCreated" TEXT NOT NULL,
      "UseDefaultValuesFlag" INTEGER,
      "Watt" REAL,
      CONSTRAINT "FK_Device_Category_Category1CategoryId" FOREIGN KEY ("Category1CategoryId") REFERENCES "Category" ("CategoryId") ON DELETE RESTRICT,
      CONSTRAINT "FK_Device_ProductType_ProductType1ProductTypeId" FOREIGN KEY ("ProductType1ProductTypeId") REFERENCES "ProductType" ("ProductTypeId") ON DELETE RESTRICT,
      CONSTRAINT "FK_Device_Supplier_Supplier1SupplierId" FOREIGN KEY ("Supplier1SupplierId") REFERENCES "Supplier" ("SupplierId") ON DELETE RESTRICT
  )
  </code></pre>