tags:

views:

353

answers:

1

The following query works. I get the correct result back when I enter the name with a wrong casing.

private static IObjectContainer db = Db4oFactory.OpenFile(db4oPath);

    public static IQueryable<Company> GetCompaniesByName(string name) { 
        return (from Company c in db
                where c.Name.ToLowerInvariant().Equals(name.ToLowerInvariant())
                select c).AsQueryable();
    }

The following query with the same parameter (basically the same unit test) returns no results. Mark the only difference is the where clause.

    public static IQueryable<Company> GetCompaniesByName(string name) { 
        return (from Company c in db
                where c.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)
                select c).AsQueryable();
    }

Why?

A: 

LINQ expression parsers are pretty much at liberty to support (or not) any set of operations they choose. In the case of LINQ-to-SQL and EF, they will throw an exception if they get confused by something (and I would expect the above to fall into this) - but it sounds like Db4o is just saying "no matches".

Does Db40 have the ability to log the queries it executes? Maybe it is doing something funky... but we can only guess...

Marc Gravell
So you too think it is something at their side, not mine. I tend to always doubt myself first because more often than not I am the one making the mistakes ;)
borisCallens