NHibernate collection mapped to table without prefix


One of the helpful things in the new NHibernate and FluentHibernate in 1.6 is that the record class can have an IList<string> (or other primitive type) and FluentHibernate maps this automatically to a table of the member name e.g. virtual IList<string> Emails maps to a table named 'Emails'.

However, everything else in Orchard is geared up to have table names with the module name prefixed, and so it isn't possible in migrations to create this table (so it has to be created manually at present).

Ideally NHibernate would be configured to map this to a table prefixed with the module name and the class name eg.

namespace Orchard.Customers
class CustomerRecord
public virtual IList<string> Emails { get; set; }

would map to a table Orchard_Customers_CustomerRecord_Emails, not Emails, but at least it needs to be mapped to something which can be created in Migrations.


sebastienros wrote Sep 24, 2012 at 7:50 PM

Do you know how to customize the mapping for this kind of object ?

DavidCornish wrote Sep 25, 2012 at 2:25 PM

Unfortunately not; I'm completely new to NHibernate & FluentHibernate and haven't yet had the time to figure out how Orchard is setting up mappings, let alone customise this myself.