Hi,
I don't seem to be able to declare a computed property (formula) inside a component (v1.2.0 beta)
Code:
...
<component name="NodeInfo" class="NHibernateHelper.NestedSet.NodeInfo, NHibernateHelper" update="false">
<parent name="Node"/>
<property name="Left" type="Int64">
<column name="ns_left" sql-type="bigint" not-null="true" />
</property>
<property name="Right" type="Int64">
<column name="ns_right" sql-type="bigint" not-null="true" />
</property>
<property name="Depth" type="Int32" formula="(SELECT Count(*) FROM document_categories dc WHERE dc.ns_left <= ns_left AND dc.ns_right > ns_left)" />
</component>
...
Exception
{"Could not compile the mapping document: MiddleLayer.Mappings.DocumentCategory.hbm.xml"}
Inner Exception
{"Unable to cast object of type 'NHibernate.Mapping.Formula' to type 'NHibernate.Mapping.Column'."}
The <property name="Depth" ... /> works fine when placed outside the <component> along with a property "public int Depth" in the main class, but if I try to move this property (both in mapping and class file) inside NodeInfo I get the above exception.
Both Left and Right properties used to be in the main class as well and I succesfully transfered them inside NodeInfo component, but I can't do the same for the computed property.
Any ideas? Tia.
Nikos.