You should not *map* it. Identifications as 'home', 'work', etc. seem to be used in a sort of contacts system. Billing is a very different address business wise. Why do you want to store it in the same system/service? How are you going to prevent or allow having a 'person' with multiple billing addresses?
'Known addresses where to find this person' is also very different business wise. Don't know for which government you are working :-p only tip I can give is to not put all your business data in huge person entity. -- Ramon On Mon, Oct 8, 2012 at 11:17 AM, barbara <[email protected]> wrote: > Thank you again. > Really this is not good to me, let me explain again. > > I'm not going to archive historical data about addresses, just archiving > all the known addresses of a person (like "mother's home", "brother's > home", "office", and so on) > They're all "valid" addresses at the moment, they are alla places where "I > could find" that person. Then, I need to know two "special" addresses which > are the "official home address" and the "billing address" (maybe the person > is a student, his "official" home address is in the city where he is > studying but billing have to be mailed to his real home, maybe in another > city, maybe his parent's home) > Is it clearer now? > I don't want to put "a flag" in the address class like "bool idHome" or > "bool isBilling" because I would need to care of updating the flags if i.e. > the billing address changes (the person says "send the bills to my aunt's > home, not my parents one", in this case I just change the reference in the > "billing" property (in the database I would have a column > "billingAddressId" in the "people" table, and I would just change it's > value, without going and change the flag on the "old" billing address in > the addresses table) > > This is what I want to do, and I want NHibernate to do it for me ;-) > > But I'm not able to map this things in xml files. :'-( > > Would you be so kind to help me again? :-D > > > > Il giorno lunedì 8 ottobre 2012 10:57:39 UTC+2, H.Alex ha scritto: >> >> 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/-/S8PO_896sGYJ. > 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. > -- 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.
