I would have this:

Address table
Address types table
Person table

AddressPersonLink table
{
AddressId
AddressTypeId
PersonId
}

Then every person would have it's addreses which would map to the 
AddressPersonLink table, and home/billing addresses would not be mapped but 
i would do them like:

public virtual Address HomeAddress
{
get { return this.Addresses.Where(p=> p.AddressType == 
"Home").SingleOrDefault();
set { this.Addresses.Remove(this.HomeAddress); this.Addresses.Add(value); }
}

Then if you need some historical data you can easily add to the 
PersonAddressLink table the dates active from and to.

On Sunday, October 7, 2012 10:37:04 PM UTC+2, barbara wrote:
>
> I have a class "person" with (amongst the others) these properties:
> - home address (of type address)
> - billing address (of type address)
> - addresses (of type List<address>, it contains all the known addresses of 
> the person)
>
> the collection "addresses" holds reference to all the known addresses of 
> the person, including the two explicitly referenced by the two other 
> properties. Or maybe the person has just one address that is referenced by 
> "home address", "billing address" and "addresses".
> How should I map this class? And also, how can I be shure that in the last 
> case the "three instances" point to the only row in the "addresses" table?
>
> Thanks in advance!
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/6MVlVdD74UQJ.
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