Hi all,
I'm fairly new to NHibernate, and I'm trying to do some mappings for my object model.
I have an Item, that has a list of Properties (each one of them is an Item of its own). So far, everything went fine.
I also added a IDictionary<Property, object> called Attributes to the Item class, in order to save the values of the Properties that the item has. I would like to save the Items in one class, and the PropertiesValues in another class.
The structure of the PropertiesValues table should be:
Code:
ItemId : uniqueidentifier
PropertyId : uniqueidentifier
Value : binary(100)
Bellow is the mapping file I tried to use:
Code:
<hibernate-mapping>
<class name="IInfoItem" table="InfoItem" lazy="false" discriminator-value="IInfoItem">
<id name="Id">
<column name="Id" sql-type="uniqueidentifier" not-null="true"/>
<generator class="guid.comb" />
</id>
<discriminator column="Type" type="string"/>
<property name="DisplayName" not-null="true" />
<property name="Version" not-null="true" />
<many-to-one name="Parent" column="ParentId" />
<bag name="Children" inverse="true" lazy="true">
<key column="ParentId"/>
<one-to-many class="InfoItem"/>
</bag>
<map name="Attributes" table="ItemAttributes" generic="true" collection-type="System.Collections.Generic.Dictionary`2[[D3.DomainModel.Property, D3.DomainModel], [System.Object, mscorlib]], mscorlib">
<key column="ItemId" />
<index-many-to-many column="PropertyId" class="Property" />
<element column="Value" type="Serializable" />
</map>
<subclass name="InfoItem" lazy="false" discriminator-value="InfoItem">
</subclass>
<subclass name="Property" lazy="false" discriminator-value="Property">
</subclass>
</class>
</hibernate-mapping>
When I'm trying to add the assembly to the Configuration, I get an exception saying "Custom type does not implement UserCollectionType".
The error message itself is pretty straight forward, and easy to understand. However, I don't fully understand what exactly I'm suppose to do in this scenario.
Can anyone assist with this?
Hibernate version: 1.2.0.3001
Code:
Code: