I'm refactoring a fluent nHibernate mapping, and I can't seem to figure this one out. I want to remap a property with type List<decimal>
to a child table, but using a single HasMany
if possible.
Right now we have: Map(x => x.DecimalList);
Which gives us a nice type of varbinary(8000)
In my attempts to move this to an ordered child table I've tried:
HasMany(x => x.DecimalList)
.Table("ParentTable_DecimalList")
.KeyColumn("Id")
.Element("Amount")
.KeyColumn("ParentId")
.Cascade.AllDeleteOrphan();
And this gives me the relationship, with two columns: ParentId
and Amount
. The only problem is that I also want to put an Order or Primary Key/ID column on the child table to ensure that we preserve the list's ordering no matter what.
Is there a way to add a strong int Primary Key column and / or an Order column without busting this out to a more complex child object/map?