Nhibernate mapping: fixed count multiple members instead of collection
Posted
by AhmetC
on Stack Overflow
See other posts from Stack Overflow
or by AhmetC
Published on 2010-04-22T02:12:58Z
Indexed on
2010/04/22
2:23 UTC
Read the original article
Hit count: 306
I don't want to put wheels into a collection. How can i map kind of relation?
Class Wheel
{
int id;
Car Owner;
}
Class Car
{
int id;
Wheel Wheel1;
Wheel Wheel2;
Wheel Wheel3;
Wheel Wheel4;
}
I tried this but Wheelmap.Owner comes always null :
Class WheelMap : ClassMap<Wheel>
{
Id(x=>x.Id);
References(x=>x.Owner);
}
Class CarMap : ClassMap<Car>
{
Id(x=>x.Id);
References(x=>x.Wheel1).Cascade.All();
References(x=>x.Wheel2).Cascade.All();
References(x=>x.Wheel3).Cascade.All();
References(x=>x.Wheel4).Cascade.All();
}
© Stack Overflow or respective owner