Reputation: 2234
It is possible to create ComponentConvention, but this code does not work because References collection is collection of IManyToOneInspector and not IManyToOneInstace. Is there any other way to specify column?
public class ComponentConvention : IComponentConvention
{
public void Apply(IComponentInstance instance)
{
foreach (var inspector in instance.References)
{
inspector.Column("some_name");
}
}
}
Upvotes: 2
Views: 958
Reputation: 43
Sadly References aren't exposed in the same way as Properties and OneToOnes. You can access the underlying ComponentMapping with reflection and then create your own ManyToOneInstances with
var mapping = (ComponentMapping) typeof (ComponentInstance).GetField("mapping", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(instance);
foreach (var r in mapping.References)
{
var ri = new ManyToOneInstance(r);
ri.Column("some_name");
}
Upvotes: 1