2

I have the following Entity Framework model which i am retrieving a number of marketing_campaign entities. A Marketing campaign can have multiple groups and each group can have multiple stores. enter image description here

What i need to be able to do is select all marketing campaigns for a particular StoreId. I know how to do the query for a single nested entity e.g. Groups.SelectMany(n => n.StoresInGroups).Where(s=>s.StoreId == 2); but not sure how to nest it deep enough to get the desired result.

Edit: Clearer picture

1 Answer 1

1
var context = new context(); // init your context here
var query = 
    from sig in context.Store.Single(p=>p.StoreId = 2).StoresInGroup //filter out by particular toreId        
    from grp in sig.Group.Marketing_Groups
    from mc in grp.MarketingCampaign
    select mc;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.