我创建了一个约定来对匹配类型的所有属性IUserTypeConvention使用实现:ICompositeUserType
public abstract class CompositeUserTypeConvention<TUserType>
: IUserTypeConvention
where TUserType : ICompositeUserType, new()
{
public virtual void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
{
var userType = new TUserType();
criteria.Expect(x => x.Type == userType.ReturnedClass);
}
public virtual void Apply(IPropertyInstance instance)
{
instance.CustomType<TUserType>();
}
}
应用此功能时,FluentNHibernate 使用约定为复合类型的每个属性生成列名{memberpropertyname}_{compositepropertyname}。
对于Money具有属性Amount和的复合类型Currency,如果我的实体上有一个名为Price类型的属性Money,则预期的列称为Price_Currency和Price_Amount。
我想要更改此约定以删除下划线,但我不知道如何或是否可能。