How to make an entity infrastructure work with archive flags?

I am trying to create a set of tables where we do not actually delete them, but instead set the flags of the archive. When we delete an object, it should not be deleted, it should be marked as archived.

What are the programming patterns to support this?

I would also prefer not to run my own stored procs for each table that has these archive flags, if there is another solution.

+5
source share
4 answers

This is an old question, and it does not indicate the version of EntityFramework. There are some good solutions for newer versions:

Entity Framework: Soft Deletes Easy

Entity Framework

Framework 5

EF 6.1.1 +

Rowan Millers EF6/EF7 Talk TechEd 2014

Entity Framework: Entity Framework 6

+1
myEntity.IsArchived = true;
context.SaveChanges();

, ; -)

+1

"MarkForDeletion" .

, - , , "", .

, , , , .

, , , , . , .

.NET 4.0, EF POCOs, , , .

0

, DeleteObject - (EFHelper - , ), ObjectContext.DeleteObject EFHelper.DeleteObject - , . , , API- .NET reflection archive_flag EntityObject, "", .

0

All Articles