I'm running into the following problem:
In this project it is mandatory that the registries should not be physically (from the database) deleted, so I create a bool property named deleted on each class that represents a table on the database.
In a delete case, the property will become true and need to be only accessible, in any case, by SQL Queries inside the Database.
I made the repositories and etc to always return the IQueryables with a query.where(x => !x.Deleted), but how can I do this on the Collections that are 'lazy loaded' by EF?
For example, when I get a Person and it has a ICollection, it always comes populated with all objects linked to that Person, I always have to filter the deleted ones manually.
Is there a way to tell EF that in every Lazy Loading it should use a custom where clause?