I have a classic scenario of a Contact having multiple addresses.
However, when displaying a list of contacts, the primary address
should also be displayed.  When fetching the list of contacts,
efficiency is of the utmost importance, so I'm pondering ways other
than just loading all addresses for each contact.

One thought is to have Contact have both a collection of Addresses as
well as a separate field for Primary Address:

class Contact {
    ICollection<Address> Addresses;
    Address PrimaryAddress;
}

The collection could be lazy-loaded while the singular address could
be loaded with a join.

Another thought would be to store the primary address as just a string
label.  This label could easily be calculated any time addresses are
manipulated:

class Contact {
    ICollection<Address> Addresses;
    string PrimaryAddress;
}

Has anyone else tackled this scenario?

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to