Search Results NHibernate C #

1

I'm doing a query in NHibernate, but I'm not able to get the desired result, I want to bring all my items from the file table that have no relation to another table called Layouts, I tried to use a where to get it back, but when I called the method inside my combo box, it was empty and checking in the bank I saw that there are 3 unrelated items. Code below.

public Ilist <Arquivo> ConsultaSemLayout()
{

    using (ISession session = FluentnHibernate.OpenSession())
    {
        return (from e in session.Query<Arquivo>() where e.Layout.Id == null select e).ToList();
    }

}
    
asked by anonymous 08.11.2017 / 12:56

1 answer

2

I think what you want to do is more or less this:

RepositorioArquivo rep = new RepositorioArquivo()
IList<Arquivo> lista = rep .ConsultaSemLayout();

ComboBox.DataSource = lista ;
ComboBox.DisplayMember = "NomeArquivo";
ComboBox.ValueMember = "IdArquivo";
    
08.11.2017 / 13:07