7
Jak mogę osiągnąć to zapytanie z Nhibernate Linq?NHibernate Linq - jak utworzyć instrukcję where z IS NOT NULL
var l = session.CreateQuery("from Auswahl a where a.Returnkey is not null").List<Auswahl>();
Próbowałem tego, ale zawsze zwraca pustą listę.
var l = session.Linq<Auswahl>()
.Where(item => !String.IsNullOrEmpty(item.Returnkey))
.Select(item => item)
.ToList();
dziękuję, masz rację. ale nie zapomnij napisać: item.Returnkey! = "" inaczej nic nie dostaniesz od oracle. SQL produkowane obecnie wygląda następująco: SELECT this_.ID jako ID1_0_, this_.Programm jako Programm1_0_, this_.Variante jako Variante1_0_, this_.Returnkey jako Returnkey1_0_, this_.Beschreibung jak Beschrei5_1_0_ Z innego this_ GDZIE (this_.Returnkey ma wartość null , a nie (this_.Returnkey = ''/*: p0 * /)) ! Jest spacja między '' :) – blindmeis
Należy pamiętać, że dla Oracle, null i the pusty ciąg znaków jest taki sam. –