DB4o Linq query - How to check for null strings
- by Dave
Hey there - simple query:
var q = (from SomeObject o in container
where
o.SomeInt > 8
&& o.SomeString != null //Null Ref here
select o;
I always get a null reference exception.
If I use String.IsNullOrEmpty(o.SomeString) the query takes about 100 times as long, as if I use && o.SomeString != "" (which is way faster, but obviously not correct).
I'm guessing because DB4o needs to activate the objects, in order to pass them in to the IsNullOrEmpty call, and can't use the indexes.
My question is, what's a better way to check for nulls in this situation? Is there something like: mystring != Db4o.DBNull.Value, or something?
Cheers,
Dave