R – Deleting a record returns from the dead after I submit changes using RIA Data Services

entity-frameworksilverlightwcf-ria-services

I have written a little program that deletes a record from the database using the RIA Data Services (Silverlight) and I am using a datagrid to view my entity.

private void DeleteButton_Click(object sender, RoutedEventArgs e)
{
    DataContext _PersonService = 
             (DataContext)(personDataSource.DomainContext);

    person removeThisPerson = (person)(dataGrid.SelectedItem);

    // This removes it from the grid/entity
    _PersonService.persons.Remove(removeThisPerson);

    // This removes it from the database. 
    // After this it shows back up in the grid :(
    personDataSource.SubmitChanges();
}

When I run the SubmitChanges() the record is removed from the grid but then reappears on the grid. It comes back to the grid with an "EntityState = New".

When I query the database, the record is gone. So, why is the entity not removing the record?

Where do the zombies come from?

Best Answer

According to this forum post, this might actually be a bug in RIA Services.

http://betaforums.silverlight.net/forums/t/112232.aspx

I suppose you could probably just refresh the page as a workaround?