Overriding deletion of entities
2 answers
You can override the method SaveChanges
as described here: Entity Framework 4.1 DbContext override SaveChanges to change audit properties
Just add your own case to remove specific types of objects.
+1
source to share
I would create a new class that extends DbSet that pushes all other things to the base, but with deletion, it also modifies your file. This should work fine with DBcontext. This also means that you can use FileAndDbSet<T>
for some objects and normal DbSet<T>
for those that do not have files with
0
source to share