Is SubSonic's CodingHorror the only way to do WHERE ISNULL?

Posted by cantabilesoftware on Stack Overflow See other posts from Stack Overflow or by cantabilesoftware
Published on 2010-06-02T01:37:41Z Indexed on 2010/06/02 1:43 UTC
Read the original article Hit count: 395

Filed under:
|

I'm trying to do a simple UPDATE ... WHERE ISNULL() using SubSonic ActiveRecord and the only way I can get it to work is by using CodingHorror. eg:

    public void MarkMessagesRead(long? from_person)
    {
        if (from_person.HasValue)
        {
            _db.Update<message>()
                .Set(x => x.is_read == true)
                .Where(x => x.from_id == from_person && x.to_id == people_id)
                .Execute();
        }
        else
        {
            new SubSonic.Query.CodingHorror(_db.DataProvider, "UPDATE messages SET is_read=1 WHERE ISNULL(from_id) AND to_id=@toid", people_id).Execute();
        }
    }

Am I missing something?

© Stack Overflow or respective owner

Related posts about subsonic

Related posts about subsonic3