fluent-nhibernate
fluent-nhibernate copied to clipboard
Allow mapping columns by convention
When mapping an IUserType or an ICompositeUserType by convention there is no ability to specify defaults for the column names.
I would like to be able to do something like
public class DateTimeOffsetConvention : IPropertyConvention, IPropertyConventionAcceptance
{
public void Accept (IAcceptanceCriteria<IPropertyInspector> criteria)
{
criteria.Expect (x => x.Type == typeof (DateTimeOffset));
}
public void Apply (IPropertyInstance instance)
{
instance.CustomType<DateTimeOffsetType> ();
instance.Columns.Add ("Utc");
instance.Columns.Add ("Offset");
}
}
You mean that default column names should be field names?
I meant property names
No, I think the current default strategy is fine, which is to take the names from the IUserType and generate "PropertyName_ColumnName", its just the defaults should be overridable by convention.