This is my entity class structure, also this is an entity framework 6, code first.
B_C table is the intermediate of B and C for their many to many relation, C_F respectively.
Starting from A i want to select all tables where a Date is in between F's EffectiveFrom and EffectiveTo. I have managed to include all tables but i need some help on the where clause. Also, the date scenario is a lot more complex than i explained, could it be done with Expression>?
This is my progress for now, but i feel i very far
var portfolios = Repo.Filter<A>(f => Some_Array_of_Ids.Contains(f.Id))
.Include("B.B_C.C.C_F.F")
.Where(w => w.B_Id != null &&
w.B.B_C.Any(a => a.C.C_F.AsQueryable().Any(dateFilterExpr)));
Update: It looks like the w.B.B_C.Any() populates all the B_C table if the expression is true even once.