I'm loading an indexed list, however the indexed numbers start at 1 and count up (not zero). When I try to iterate over the loaded list using foreach, the first element comes back null. I could explicitly check for null, but I'm not sure how much code actually iterates over this list, and I'd have to change it all. I was wondering if there was some sort of "offset" parameter for the <index> field of the NHibernate mapping file. Something like:
Code:
<list name="appliances" cascade="all" lazy="true">
<key column="ProductId" />
<index column="position" offset="1" />
<one-to-many class="SpringAir.Objects.Appliance, SpringAir.Objects" />
</list>
So NHibernate would subtract the offset before using it as an index when loading it into the list. I hope I'm explaining this well...
I just realized I may also have another problem. The list of loaded objects may have overlapping indices in some cases, because there are two rows of appliances; they are differentiated in the list by another identifier (bool or int to indicate which row it's in). Will this be a problem?
I see in the documentation that there are undocumented <index-many-to-many>, <composite-index> and <index-many-to-any> possibilities. Anything of help there?