Hi,
The basic relationship is something like:
SiteUser --> Person -->> PersonPhone --> Phone
where PersonPhone has a PhoneType attribute. The SELECT I'm trying to model is:
select su.UserName, ph.DisplayPhoneNumber as PhoneNumber, fax.DisplayPhoneNumber as Fax, mobile.DisplayPhoneNumber as Mobile, p.*
from SiteUser su
join Person p on su.PersonId = p.PersonId
left join PersonPhone ph on p.PersonId = ph.PersonId and ph.PhoneTypeId = 1001 -- Primary phone
left join PersonPhone fax on p.PersonId = fax.PersonId and fax.PhoneTypeId = 1002 -- Fax
left join PersonPhone mobile on p.PersonId = mobile.PersonId and mobile.PhoneTypeId = 1003 -- Mobile
where p.PersonId = 1058
Note that I left Phone out of the above SELECT...it's optional in this case.
I don't need a filter example for the above (which I already have), I want to build an object graph in this case. I haven't found any PathEdge examples that allow for multiple "types" (phone numbers in this case). A single edge works fine:
var q = (from su in metaData.SiteUser
where su.SiteUserId == userId
select su).WithPath(new PathEdge<PersonEntity>(
SiteUserEntity.PrefetchPathPerson,
new PathEdge<PersonPhoneEntity>(PersonEntity.PrefetchPathPersonPhones, ph => ph.PhoneTypeId == (int)PhoneType.PrimaryPhone,
new PathEdge<PersonPhoneEntity>(PersonPhoneEntity.PrefetchPathPhone))
));
Trying to add a new edge differentiated only by the filter returns an exception.
I'm trying to build a graph with:
SiteUser
Person
PrimaryPhone
Fax
Mobile
While I could return a collection of PersonPhone objects, in this case I would like to return individual Entities. How do I add the additional PersonPhone PathEdge's that are differentiated by the filter?
Thanks!