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

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -