Filtering Inner Collection in Entity Framework -
i have teams , each team holding products collection , products holding branches collection. each of above entity having field say: isactive want retrieve teams, products, branches active ( isactive=true).
system.data.entity.infrastructure.dbquery<team> query = dbcontext.teams.asnotracking(); query = query.include("products"); query = query.include("products.branches"); //filtering active teams querymod = querymod.where(b => b.isactive == active.value); //filtering active products querymod = querymod.where(b => b.products.where(c => c.isactive == active.value).all(d=>d.isactive==active.value)); //filtering active branches querymod = querymod.where(b => b.products.all(c => c.branches.all(d=>d.isactive == active.value) && c.isactive == active.value));
but looks not working expected. correct form of using statement filter inner groups direction or appreciated!.
thanks
Comments
Post a Comment