So, I have problems displaying problems in free nhibernate. I want to use join mapping to smooth the staging table: Here is my structure:
[Vehicle]
VehicleId
...
[DTVehicleValueRange]
VehicleId
DTVehicleValueRangeId
AverageValue
...
[DTValueRange]
DTVehicleValueRangeId
RangeMin
RangeMax
RangeValue
Please note that DTValueRange does not have a VehicleID. I want to flatten a DTVehicleValueRange into my Vehicle class. Tgis works fine for AverageValue, as it's just a value, but I can't get the ValueRange collection to display correctly.
public VehicleMap()
{
Id(x => x.Id, "VehicleId");
Join("DTVehicleValueRange", x =>
{
x.Optional();
x.KeyColumn("VehicleId");
x.Map(y => y.AverageValue).ReadOnly();
x.HasMany(y => y.ValueRanges).KeyColumn("DTVehicleValueRangeId");
});
}
The HasMany mapping does not seem to do anything if it is inside Join. If it is outside Join and I specify the table, it displays, but nhibernate tries to use VehicleID, not DTVehicleValueRangeId.
What am I doing wrong?