Skip to content

Instantly share code, notes, and snippets.

@ro31337
Created August 22, 2014 12:07
Show Gist options
  • Save ro31337/bbb0c39a61fa5ef936df to your computer and use it in GitHub Desktop.
Save ro31337/bbb0c39a61fa5ef936df to your computer and use it in GitHub Desktop.
public class MyContext : DbContext
{
//...
public override int SaveChanges()
{
foreach (var entry in ChangeTracker.Entries()
.Where(p => p.State == EntityState.Deleted))
SoftDelete(entry);
return base.SaveChanges();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment