Adding Configurability of Prefix for ICompositeUserType Columns
In a project I'm currently working on I need to change the prefix for the columns created for an ICompositeUserType property.
Currently the column name from the user type is hard coded to be prefixed with "PropertyName_": column.Name = propertyPrefix + "_" + propertyName;
As I see it, something like the GetComponentColumnPrefix func in the automapping is needed, but I guess that in this case it would be needed in both automapping and ordinary fluent mapping.
I'd be happy to implement it and send a pull request, but the question is where to put the functionality.
Two possible ways to implement it, so that it could be used from IUserTypeConventions and ClassMaps (if I'm not mistaken):
-
A new method on PropertyInstance, perhaps
public void CustomTypeColumnPrefix(Func<Member, string> getColumnPrefix);
and/orpublic void CustomTypeColumnPrefix(string prefix)
-
Overloading the CustomType methods to also take a
Func<Member, string>
and/or a prefix string
Does this sound reasonable, or am I way off?
Thanks
/Erik Öjebo
2 Posted by Alex Davidson on 23 Aug, 2010 11:04 AM
+1 for this idea.
Implementing this via PropertyInstance would be preferred for our use case, where it would be nice to be able to provide a convention that uses the property name as the prefix for its subfields.