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);
}
}
The kind of class I'd be trying to map with a new convention is:
public class Customer
{
public virtual IEnumerable<Order> Orders
{
get
{
return xyz_orders;
}
}
private readonly IList<Order> xyz_orders = new List<Order>();
}
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?