7
come posso ottenere questa query con Nhibernate Linq?NHibernate Linq - come creare un'istruzione where con IS NOT NULL
var l = session.CreateQuery("from Auswahl a where a.Returnkey is not null").List<Auswahl>();
ho provato questo ma restituisce sempre una lista vuota.
var l = session.Linq<Auswahl>()
.Where(item => !String.IsNullOrEmpty(item.Returnkey))
.Select(item => item)
.ToList();
grazie, hai ragione. ma non dimenticare di scrivere item.Returnkey! = "" altrimenti non ottieni nulla da Oracle. l'Sql prodotto appare come segue: SELEZIONA this_.ID come ID1_0_, this_.Programm come Programm1_0_, this_.Variante come Variante1_0_, this_.Returnkey come Returnkey1_0_, this_.Beschreibung come Beschrei5_1_0_ DA AUSWAHL this_ WHERE (this_.Returnkey non è null e non (this_.Returnkey = ''/*: p0 * /)) ! C'è uno spazio vuoto tra '' :) – blindmeis
È da ricordare che, per Oracle, null e il la stringa vuota è la stessa. –