1

I have below tables

1. Address -> AddressID
2. Designation -> DesignationID
3. Stores -> StoreID, AddressId
4. Contacts -> ContactID, StoreID, DesignationID
5. ContactsAddresses => ContactID, AddressID

and related NavigationProperties. I want to load all the Stores with all Contacts and their contact's associated Data (Designation and ContactsAddresses)

I tried something like below:

this.ObjectContext.Stores.Include("Contacts.Designation.ContactsAddresses")
   .Include("Address");

I have a doubt that when I write Contacts.Designation.ContactsAddresses -> whether it consider ContactsAddresses as Contacts navigation property or Designation's navigation Property. Cause I also need to include Address in ContactsAddresses. Its multiple hierarchy which needs to be resolved.

I want to have each contact's Designation and all addresses. Can anyone please help me solving this issue.

1 Answer 1

2

Explicitly specify the two include paths.

this.ObjectContext.Stores.Include("Contacts.Designation")
     .Include("Contacts.ContactsAddresses");
Sign up to request clarification or add additional context in comments.

1 Comment

@TejasPatel Removed an extra property in second Include method. I tried this and worked.

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.