NHibernate sub-collection using QueryOver -
i have simple classes:
public class order { public int id {get;set;} public ilist<name> names{get;set;} } public class name { public int id {get;set;} public int langid {get;set;} public string localname {get;set;} }
the quesetion how query subcollection of order
have order.names.localname (something this):
ilist<order> orders = repository.getbyproductlocalname("laptop");
i use new nh3 feature queryover, not using linq (i'v found solutions in of them uses linq).
all need declare alias variable names collection , can use in clause...
string localname = "laptop"; name namesalias = null; return session.queryover<order>() .joinalias(x => x.names, () => namesalias) .where(() => namesalias.localname == localname) .transformusing(transformers.distinctrootentity) .list<order>();
Comments
Post a Comment