Search result Nhibernate C#

Asked

Viewed 60 times

1

I am making a query in Nhibernate, but I am not able to bring the desired result, I want to bring all my table items file that have no relation to another table called Layouts, I tried to use a Where so that it returned me, 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();
    }

}

1 answer

1


I think what you want to do is about that:

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

ComboBox.DataSource = lista ;
ComboBox.DisplayMember = "NomeArquivo";
ComboBox.ValueMember = "IdArquivo";

Browser other questions tagged

You are not signed in. Login or sign up in order to post.