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

Add DbException.IsTransient property #38837

Closed
wants to merge 13 commits into from
Closed

Add DbException.IsTransient property #38837

wants to merge 13 commits into from

Conversation

rgarrison12345
Copy link

@rgarrison12345 rgarrison12345 commented Jul 7, 2020

Fixes #34817

@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@rgarrison12345 rgarrison12345 changed the title v Resolves #35179 Jul 7, 2020
@ghost
Copy link

ghost commented Jul 7, 2020

Tagging subscribers to this area: @roji, @ajcvickers
Notify danmosemsft if you want to be subscribed.

@jkotas jkotas changed the title Resolves #35179 Add DbException.IsTransient property Jul 7, 2020
@jkotas
Copy link
Member

jkotas commented Jul 7, 2020

Could you please also add a test?

@rgarrison12345
Copy link
Author

Hello @jkotas, I'm aware that for a new pull request Microsoft would like to see a test for the functionality.

However, this is adding a property to the DbException class with a default implementation. The idea is providers like Microsoft.Data.SqlClient, MySqlConnector, NpgSql will actually implement that property. With that in mind I didn't see the value of a test because the derived class is expected to set that property. If there is something specific you have in mind I can do the test

@jkotas
Copy link
Member

jkotas commented Jul 7, 2020

The test can be very simple: Just call the base class property and check that it returns false.

@jkotas
Copy link
Member

jkotas commented Jul 7, 2020

Could you please resolve the conflict?

@roji
Copy link
Member

roji commented Jul 7, 2020

@rgarrison12345 thanks for this! Can you please squash your commits and rebase them so it's a single, clean commit on top of the latest master branch commits (no merge commits)?

Note that there's also #35601 for adding SqlState to DbException. There was also a proposal in the design discussion to provide a default implementation of IsTransient by looking at SqlState, and identifying some specific values which are inherently transient. This doesn't have to be done right away though.

Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

Please check the spurious DbException constructors introduced here. It's also best to squash these 13 commits into a single one on top of master (no merge commits necessary).

protected DbException() { }
protected DbException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
protected DbException(string message) { }
Copy link
Member

@roji roji Jul 8, 2020

Choose a reason for hiding this comment

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

Looks like this slipped in by mistake, please remove.

@roji
Copy link
Member

roji commented Jul 11, 2020

@rgarrison12345 any reason for closing this? If you intend to open a new PR for this, please reopen this one instead, and force-push to its branch (a new PR would require new approval etc.). Otherwise please let me know and I'll do this functionality.

@rgarrison12345
Copy link
Author

rgarrison12345 commented Jul 11, 2020

@rgarrison12345 any reason for closing this? If you intend to open a new PR for this, please reopen this one instead, and force-push to its branch (a new PR would require new approval etc.). Otherwise please let me know and I'll do this functionality.

Hello @roji, I'll admit I'm fairly new with the Git workflow. I'm more familiar with TFS. When I did the pull request originally I thought I had latest, but it's apparent I didn't and that was causing some issues. I was closing this to open a new one to start over fresh.

Can you do this functionality? I want to contribute, I think I need to learn more about git in the meantime.

@roji
Copy link
Member

roji commented Jul 11, 2020

Sure, I'll soon submit a PR for both this and #35601. Git is indeed non-trivial for newcomers, but it's well-worth the investment to learn it! Hope to see more contributions from you soon.

@roji
Copy link
Member

roji commented Jul 12, 2020

Replaced by #39157

@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Database-agnostic way to detect transient database errors
5 participants