I have also tried this with bag. this I can cast into a .Net type. here's my config files and code;
NHibernate mapping file;
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="CostModelIQ.BusinessLogicLayer.ShippingAddress, BusinessLogicLayer" table="Shipto">
<id name="Identifier" column="Shipto" type="String" length="6">
<generator class="assigned" />
</id>
<property name="Customer" column="Customer"/>
<property name="Name" column="Name"/>
<property name="Variation" column="Variation"/>
<property name="AddressLine1" column="Address_Line_1"/>
<property name="AddressLine2" column="Address_Line_2"/>
<property name="City" column="City"/>
<property name="PostCode" column="Post_Code"/>
<property name="DeletedIndicator" column="Delete_Ind"/>
<property name="Ambient" column="Ambient_Destination"/>
<property name="Chilled" column="Chilled_Destination"/>
<set name="Alias" cascade="all" lazy="true">
<key column="ShipAddress"/>
<one-to-many class="CostModelIQ.BusinessLogicLayer.Alias,BusinessLogicLayer"/>
</set>
</class>
</hibernate-mapping>
The mapping file for the Alias object;
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="CostModelIQ.BusinessLogicLayer.Alias, BusinessLogicLayer" table="[Shipto Variation]">
<composite-id>
<key-property name="StorageLocation" column="Storage_Location"/>
<key-property name="ShipAddress" column ="Shipto_Variation"/>
<key-property name="AliasID" column="Shipto"/>
</composite-id>
</class>
</hibernate-mapping>
C# code;
[Serializable]
public class ShippingAddress:BaseBusinessObject
{
private IDictionary alias;
/// <summary>
/// returns a list of alternative names this shipping address is referred to by.
/// </summary>
public virtual IDictionary Alias
{
get
{
return alias;
}
set
{
alias = value;
}
}
}
|