Hi begy,
I can see your desire for .isDeleted for Parent & Child Entities.
ChildEntities.isDeleted()
If you wanted to add an .isDeleted() flag for Child Entities, this is not always quite so black & white.
A.) First, simply because you remove an entity from a collection does not necessarily mean that you want it marked .isDeleted.
B.) Second, an entity can be in many collections - so how do you know which collection the entity is really in, and whether it really is to be deleted? For instance, take the lookup table in a many-to-many relationship. This lookup table has two many-to-one relationships. Which of these two relationships do you investigate to determine if the entity it is to be deleted? One? Both? You would have to investigate both, or in other words - all many-to-one relationships.
If you really wanted this - Here's what you could do:
1.) Create Partial class for CommonEntityBase
2.) Create Readonly Property isDeleted
3.) Within isDeleted Get method, loop through all my relations. If relation is many-to-one (I am one child belonging to a parent) - get Parent entity. Then, get Parent's collection (which should contain all my siblings) & investigate its RemovedEntititesTracker property. If I am in in this RemovedEntitiesTracker collection, then return isDeleted = True.
ParentEntity.isDeleted()
PS. If you wanted to hold an .isDeleted() flag for the Parent entity - This would require that the Entity have knowledge about the UnitOfWork that it is in. The LLBLGen framework is currently designed away from this. Entities & Collections do not know they are within a UnitOfWork.
Instead - Couldn't you just look at the UnitOfWork.GetEntityElementsToDelete? And verify your entity isn't going to be deleted in the UnitOfWork?
Hope this helps!
Ryan D. Hatch