FluentNHibernate: Just another Mapping Question
Which convention should be used to alter column name of CompositeId().KeyReference(x=>x.Key,/*THIS PART*/)
method? I have used all available conventions in FluentNHibernate.Conventions and still haven't found the answer.
Thanks 开发者_Go百科in advance
still not possible now (FNH 1.2), except with some reflection-magic
class CompositeKeyConvention : ICompositeIdentityConvention
{
public void Apply(ICompositeIdentityInstance instance)
{
var columninspector = instance.KeyManyToOnes.First(k => k.Name == "Key").Columns.First();
var columnmapping = (ColumnMapping)columninspector.GetType().GetField("mapping", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic).GetValue(columninspector);
columnmapping.Name = "mycolumnname";
}
}
精彩评论