In my case I have a table with the field "IsToDelete" (bit/boolean) where we delete these entries during maintenance time. But regarding the actual aplication we do not process these entries, we ignore them always by using the where condition istodelete == false.
We have several places where we use something like ".Include(x=>x.MyEntities) I know that some people made similar questions such as: EF: Include with where clause
However, my question is regarding another type of approach: there are really some places were its not so good idea to "create" a "temp" mapped object (as suggested in EF: Include with where clause).
When we are defining the EF code first mapping (EntityTypeConfiguration). We have something similar to:
this.Property(t => t.IsToDelete).HasColumnName("IsToDelete");
I am thinking of a solution more of the kind "SQL Views" but without really have a "view". Can we do it in this "mapping" file or in some other way (ALWAYS apply this filter)?
P.S. Human error of forgetting to add the where condition will no longer occur.