Aylmer carson - 165 - Dec 14, 2013

Re SQL Server bit column + mapping to SS Bool property.

I have a bit column in sql server and it maps to a bool property in an entity. 

when I execute the following, I always get the bool property set to ‘false’, even though I know it contains ‘true’ values. what am I missing?

                Action response = new Action();
                response = Db.Single<Action>(“select ActionId, IsOpen from [Action]”);

aylmer carson:

a workaround is:

                    SqlExpression<Action> ev = OrmLiteConfig.DialectProvider.SqlExpression<Action>();
                    ev.Select(rn => new { rn.ActionId, rn.IsOpen});
                    response = Db.Single<Action>(ev);

but wondering why the call to straight t-sql doesn’t work. is it not supposed to?

And of course I can’t use this where the query requires table joins :frowning: