how can i achieve this query with Nhibernate Linq?
var l = session.CreateQuery("from Auswahl a where a.Returnkey is not null").List<Auswahl>();
i tried this but it always returns an empty list.
var l = session.Linq<Auswahl>()
.Where(item => !String.IsNullOrEmpty(item.Returnkey))
.Select(item => item)
.ToList();
Have you tried:
var l = session.Linq<Auswahl>()
.Where(item => item.Returnkey != null && item.Returnkey != "")
.Select(item => item)
.ToList();
I'm not sure that using String.IsNullOrEmpty would work, also it checks for two conditions - if it's NULL and if it's a blank empty string, how would that get translated into SQL? Might be worth having a look at SQL Profiler to see the raw SQL query it generates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With