I've been trying to specify a custom naming convention for my database table columns. So far, I have been able to setup a convention for the table's name, but not the actual columns. I've seen a few guides on the internet, but they're not working using the latest Fluent NHibernate (1.0.0 RTM).
public class CamelCaseSplitNamingConvention : IClassConvention, IComponentConvention
{
    public void Apply(IClassInstance instance)
   开发者_开发问答 {
        instance.Table(instance.EntityType.Name.ChangeCamelCaseToUnderscore());
    }
    public void Apply(IComponentInstance instance)
    {
        // is this the correct call for columns? If not, which one?
    }
}
Please help.
To create a convention for column names you should use an IPropertyConvention rather than an IComponentConvention.
For example (using the same method to convert camel case to underscore as in your example code):
public class ColumnNameConvention : IPropertyConvention
{
    public void Apply(IPropertyInstance instance)
    {
        instance.Column(instance.Property.Name.ChangeCamelCaseToUnderscore());
    }
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论