I doubt this is possible but I will ask it anyway, just in case, is it possible to adapt lazyloading to only load child object who’s ‘IsDeleted’ property is false?
This is just to help with the fact I need to add .where(x => !x.IsDeleted) to most of my methods, which is messy in my opinion.
edit
My entities are created using CodeFirst
Many thanks
It is possible if you use conditional mapping. In such case EF will never load anything with
IsDeletedset to true but in the same timeIsDeletedcolumn will not be available in your entity at all (because it will be used for mapping). If your application can also set this flag you will need to map stored procedures for entity – you can even map stored procedure for delete operation which will instead set the flag in the database instead of deleting the item.