I've been using nhibernate for a few months now and I am starting to be confident with it but there are still lots of things that I need to explore.
Till now I've mapped addresses as components. Here's an example:
<class xmlns="urn:nhibernate-mapping-2.2" mutable="true" name="Lead" table="Leads">
<id name="Code" type="System.Guid">
<column name="LeadCode" />
<generator class="guid.comb" />
</id>
<property name="FirstName">
<column name="FirstName" length="40" not-null="true" />
</property>
<property name="LastName">
<column name="LastName" length="40" not-null="true" />
</property>
<component name="PrimaryAddress" class="Address">
<property name="Street" type="AnsiString">
<column name="PrimaryStreet" length="100" />
</property>
<property name="City">
<column name="PrimaryCity" length="30" />
</property>
<property name="State">
<column name="PrimaryState" length="20" />
</property>
<property name="PostalCode">
<column name="PrimaryPostalCode" length="10" />
</property>
<property name="Country">
<column name="PrimaryCountry" length="40" />
</property>
</component>
<component name="AlternativeAddress" class="Address">
<property name="Street">
<column name="AlternativeStreet" length="100" />
</property>
<property name="City">
<column name="AlternativeCity" length="30" />
</property>
<property name="State">
<column name="AlternativeState" length="20" />
</property>
<property name="PostalCode">
<column name="AlternativePostalCode" length="10" />
</property>
<property name="Country">
<column name="AlternativeCountry" length="40" />
</property>
</component>
</class>
</hibernate-mapping>
Now, I would like to extend this model and separate the addresses in a different table so that one Lead can have different types of addresses.
I would like - possibly - to use an enum to manage different types of addresses.
Every help or link to documents where I can find more infos would be appreciated.