Can Fluent NHibernate be configured to use an arbitrary prefix on a property backing field?

Posted by dommer on Stack Overflow See other posts from Stack Overflow or by dommer
Published on 2010-04-09T11:49:57Z Indexed on 2010/04/09 11:53 UTC
Read the original article Hit count: 210

Filed under:

I'm currently using a convention to (auto)map collection properties to backing fields in Fluent NHibernate. So, I map a property "Orders" to a field "_orders". The convention I'm using to do this is:

public class HasManyAccessConvention : IHasManyConvention
{
    public void Apply(IOneToManyCollectionInstance instance)
    {
        instance.Access.CamelCaseField(CamelCasePrefix.Underscore);
    }
}

Can I write a convention that maps a (collection) property to a field with a non-standard prefix (ignoring whether this is good coding practice for the present)? So, the property "Orders" would be mapped to "xyz_orders", for example.

If so, how would I go about this?

© Stack Overflow or respective owner

Related posts about fluent-nhibernate