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

Clear DbCommand.Parameters only after reader is disposed #9308

Merged
merged 1 commit into from
Aug 1, 2017

Conversation

smitpatel
Copy link
Member

Resolves #9277

Issue: For #6249 which allows query with FromSql be called twice, we start clearing out DbCommand.Parameters collection so same DbParameters can be used in another command. Though we cleared out Parameters after creating the reader assuming we wouldn't need parameters after command is executed. But for out parameters value is not set until DbReader is disposed.
Solution: We should clear out Parameters right before disposing the Command. That makes sure that reader is not open/undisposed and still can reuse the parameter with another command.

This blocks reusing the same parameter till first command is disposed. But behavior of that with out parameter would be weird.

Copy link
Member

@AndriySvyryd AndriySvyryd left a comment

Choose a reason for hiding this comment

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

Open a new issue to consider this for a patch

@smitpatel smitpatel merged commit 003f0ce into dev Aug 1, 2017
@smitpatel smitpatel deleted the fromsqloutparameter9277 branch August 1, 2017 01:13
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.

4 participants