How do I organize a collection of subclasses in Fluent NHibernate using a property of the parent class?

Whew .... tried putting it all in the header there :)

I have a base class / table for the Content items in my CMS. I have a subclass of ContentItem that has its own table, so I map it to the SubClassMap base.

Now I have another class with a collection of these ContentItems. I would like to make OrderBy in this collection using the SubmittedDate property defined in the base class, and not a subclass:

// Collection of items: HasMany(x => x.Items) .AsBag() .Cascade.AllDeleteOrphan() .Inverse() .KeyColumn("ListId") .LazyLoad() .OrderBy("SubmittedDate desc, Title asc"); 

However, when I try to access the collection, I get an exception that states that "SubmittedDate" was an invalid column.

Is it possible to use a column from a base class table for .OrderBy in FNH?

+4
source share

All Articles