Mam encję TypuX w niej pole (component) TypuY
public class TypX
{
public virtual Id {get;set;}
public virtual TypY Y {get;set;}
}
public class TypY {
public virtual int Pole1 {get;set;}
}
czyli w tabeli TypX mam:
Id int not null,
Y_Pole1 int null
mapping dla TypX:
Component<TypY>(x => x.Y, m => {
m.Map(y => y.Pole1, "Y_Pole1");
});
jak automtycznie loadować Y przy pobieraniu encji TypX?
Działa mi tak:
QueryOver
.Fetch(x => x.Y).Eager
.Fetch(x => x.Y.Pole1).Eager
.Where(x => x.Id == xId)
.SingleOrDefault();
Ale! kiedy Y_Pole1w bazie jest null, to pole X.Y też jest null.