Darwin wrote:
Employee is in a 1: 1 relationship with Contact.
Phone is in a m:1 relationship with Contact.
I need to get the Phone Numbers for an Employee.
In project explorer nothing related to Contact is automatically discovered from within the Employee. I cannot add the relationship manually. I would need to add a 1: m relationship for Employee - Phone, but using the Employee.ContactID as the key on the Employee side, not the Employee ID. Or I tried to add a m:n relationship manually. To do this the first side must be in a 1:n relationship... which Employee - Contact is not, so it can't be used.
You select phone entities based on a filter on employee. So:
RelationCollection relations = new RelationCollection();
relations.Add(PhoneEntity.Relations.ContactEntityUsingContactID);
relations.Add(ContactEntity.Relations.EmployeeEntityUsingContactID);
PredicateExpression filter = new PredicateExpression();
filter.Add(...// here you add the filter on employee);
Now, you pass relations and filter to a PhoneCollection.GetMulti() to get the phones.