this is my model
public class A{
public int Id {get; set;}
public ICollection<B> bs {get; set;}
}
public class B{
public int Id {get; set;}
public ICollection<C> cs {get; set;}
}
public class C{
public int Id {get; set;}
}
now i want to get Max(Id) of C class of a B object of an A object:
public int GetMaxId(int idA, int idB)
i try some diffente way:
var max= _session.QueryOver<A>().Select(a => a.Bs)
.Where(a => a.Id == idA).SingleOrDefault<ICollection<B>>()
.Where(b => b.Id == idB).FirstOrDefault<B>().Cs.Max(c => c.Id);
and
var max = _session.QueryOver<A>().Where(a => a.Id == idA).Select(a => a.Bs.Where(b => b.Id == idB)).Future<B>().Max(c => c.Id);
but nothing works
any way to do this? Thanks