internal static bool ToBoolean(object value) { if (IsUnknown(value)) { return(false); } if (value is bool) { return((bool)value); } if (value is SqlBoolean) { return(((SqlBoolean)value).IsTrue); } //check for SqlString is not added, value for true and false should be given with String, not with SqlString if (value is string) { try { return(bool.Parse((string)value)); } catch (Exception e) when(ADP.IsCatchableExceptionType(e)) { ExceptionBuilder.TraceExceptionForCapture(e); throw ExprException.DatavalueConversion(value, typeof(bool), e); } } throw ExprException.DatavalueConversion(value, typeof(bool), null); }