Skip to content

Comments

Changed Contains query to ensure bool convertion#17

Open
fsnader wants to merge 2 commits intomasterfrom
bugfix/invalid-sql-cast
Open

Changed Contains query to ensure bool convertion#17
fsnader wants to merge 2 commits intomasterfrom
bugfix/invalid-sql-cast

Conversation

@fsnader
Copy link

@fsnader fsnader commented Oct 7, 2019

Changed contains SQL query to ensure BIT casting and C# code to return always a bool

{
return (bool)await command.ExecuteScalarAsync(cancellationToken).ConfigureAwait(false);
var queryResult = await command.ExecuteScalarAsync(cancellationToken).ConfigureAwait(false);
return queryResult is bool result && result;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to throw an exception instead of silently accepting if the query returns a value different than boolean._

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe is better to remove this modification and leave just the changed SQL?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants