Hello,
We have the following table structure:
| Address |
-----------
| Id |
| Street |
| City |
-----------
| Person |
-----------------------
| Id |
| Name |
| VisitingAddressId |
| PostalAddressId |
| <Some extra fields> |
-----------------------
| Organisation |
-----------------------
| Id |
| Name |
| VisitingAddressId |
| PostalAddressId |
| <Some extra fields> |
-----------------------
Basically our objects are modelled the same way. The Person and
Organisation are completely different and should not inherit from each
other in any way.
The mapping we use is basically the following (both Person and Organisation
have a similar mapping):
public class PersonMap : ClassMap<Person>
{
public PersonMap()
{
Id(x => x.Id);
Map(x => x.Name);
References(x => x.VisitingAddress).Cascade.All();
References(x => x.PostalAddress).Cascade.All();
}
}
>From address there is (at the moment) no mapping to either Person or
Organisation.
Since the visiting has a public setter, the addresses could be overridden
by replacing the address instance with a new instance of Address, when
saving the Person or Organisation, the original address will be orphaned.
Is there a way (other than making the setters non public) to prevent this?
Kind regards,
David Perfors
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.