I'm trying to follow the custom collection workaround defined here:
http://colinjack.blogspot.ie/2008/09/nhibernate-mapping-custom-collections.html
So the basic classes involved are **MyContainingClass **and FooCollection. **MyContainingClass **has a member of type FooCollection.
The problem I have is trying to convert the hbm mapping to a fluent nhibernate equivalent. The article refers to this mappping
<component name="FooCollection" access="nosetter.camelcase-underscore">
<bag name="_innerList" cascade="all-delete-orphan" access="field" lazy="true">
<key column="ContaingClassesID" />
<one-to-many class="..." />
</bag>
</component>
and I have attempted to alter MyContainingClassMap.cs to add the following
Component(a => a.FooCollection,cp =>
cp.HasMany<Foo>(Reveal.Property<FooCollection>("Items"))
.Table("Foo")
.KeyColumn("MyContainingClassId").AsBag());
However when I attempt to add a Foo item to MyContainingClass.**FooCollection **nothing is persisted. Is my mapping conversion bogus or is something else at play?
Reference
public partial class FooCollection : MyProject.Common.Collections.BaseList<Foo>
{
private IList<Foo> items;
partial void OnCreated();
public IList<Foo> Items
{
get { return items; }
set { items = value; }
}
public FooCollection ()
{
items = this.baseList;
}
}