For LinqToSQL is 0 true or is 1 (for type Bit)?

Posted by Vaccano on Stack Overflow See other posts from Stack Overflow or by Vaccano
Published on 2010-03-16T21:25:46Z Indexed on 2010/03/16 21:31 UTC
Read the original article Hit count: 139

Filed under:
|
|
|

I have a column of type Bit (called BBoolVal in this example).

I have a LinqToSQL Statement Like this:

var query = List<MyClass> myList = _ctx.DBList
              .Where(x => x.AGuidID == paramID) 
              .Where(x => x.BBoolVal == false);

When I look at the sql it ends up like this (I added the spacing and changed the names):

SELECT    [t0].[Id], [t0].[AGuidID], [t0].[OtherIDID], 
          [t0].[TimeColumn], [t0].[BBoolVal], [t0].[MoreID]
FROM      [dbo].[MyTable] AS [t0]
WHERE (NOT ([t0].[BBoolVal] = 1)) AND ([t0].[AGuidID] = @p0)

Because my x.BBoolVal == false translates to [BBoolVal] == 1 I gather that false = 1 (and thus true = 0).

I am asking because this seems a bit backwards to me. I am fine to accept it, I just want to be sure.

© Stack Overflow or respective owner

Related posts about linq-to-sql

Related posts about LINQ