Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign comment for query, so it will make debugging easier #226

Open
ahmad-moussawi opened this issue Mar 28, 2019 · 1 comment
Open

Assign comment for query, so it will make debugging easier #226

ahmad-moussawi opened this issue Mar 28, 2019 · 1 comment

Comments

@ahmad-moussawi
Copy link
Contributor

@ahmad-moussawi ahmad-moussawi commented Mar 28, 2019

new Query("Users")
.Comment("Fetch invalid users")
.WhereTrue("Invalid");

We can log it using

queryFactory.Logger = (compiled, query) =>
{
    logger.LogInformation("// " + query.GetComment() + "\n" + compiled.ToString() + "\n", compiled.Bindings);
};

Output

// Fetch invalid users
SELECT * FROM [Users] WHERE [Invalid] = 1
@njqdev
Copy link

@njqdev njqdev commented May 14, 2019

It already had a QueryComment property, but I added GetComment anyway. And to avoid a null reference exception I made those changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.