Soft deleting entities

Feb 24, 2016 at 9:13 PM
Continuing on my exploration of VITA framework I have one more thing to figure out. The framework I'm traying to take over does soft delete in database setting a specific field value to 1.

Do you think this is something that is transparently doable, maybe with an attribute or inheriting a base interface ? My goal is not to replace the actual delete because I can chose to not soft delete an entity but rather having the framework filter out all soft deleted entities in the lazy loading, references and query for me.

Maybe is something I can help figure it out
Feb 24, 2016 at 10:00 PM
oh, man, that's tough.. although it is worth pursuing because it is very common situation, many people use it. I believe it's doable, but needs some core framework work, not something with extra attribute. I will look at it and let you know when I can make it happen. So definitely will be there at some point, the question is how well it will fit with all other features (LINQ and stored procs)
Feb 24, 2016 at 10:40 PM
Well let me know if I can be of any help. I really need this to have auto/lazy loading to work nicely.
Is there a way, just for testing, to apply a filter to a OneToMany relationship on an entity so I can filter out the delted entites? I can manually filter out the rest at the moment.
Feb 24, 2016 at 10:41 PM
Edited Feb 24, 2016 at 10:42 PM
for now, to make sure I'll cover your particular case - what's the column props? int/bit? IsDeleted?
how about MySql/Oracle, column name, type, values
Feb 24, 2016 at 10:43 PM
no, way to filter these lists for now... will think about this...
Feb 24, 2016 at 10:53 PM
atm is an int column with 1 for delted record an dI have it in MSSQL and MySql, no oracle scenario with these cases yet (thank god).
The ideal solution would be to have the column name configurable (now name is "canc"), for the value type I would say anything that maps to a .net bool or int value could be enough.
Feb 26, 2016 at 7:57 AM
Added Filter property to OneToMany attribute, works with LINQ too
Feb 26, 2016 at 9:08 AM
Great! I think this could be also a nice feature to have for general purpose