Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Merge | SqlConfigurableRetryLogicLoader#3246

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

benrr101
Copy link
Contributor

Description: Here is the latest merge PR to get us to a single project. This edition brings the netcore SqlConfigurableRetryLogicManager.NetCoreApp.cs and the netfx SqlConfigurableRetryLogicManager.LoadType.cs files into the common project SqlConfigurableRetryLogicLoader class. These files actually contained partial classes of the *Loader class and provided separate implementations of the LoadType functionality.

I also separated interfaces from SqlConfigurableRetryLogicLoader that should be in their own files. Lastly, I started getting carried with stylistic cleanup of the class, but stopped before it went too crazy. I have a follow up PR with those cleanup changes queued up for after this PR.

Testing: Project still builds, no functional changes.

@benrr101benrr101 added the Common Project 🚮Things that relate to the common project project labelMar 26, 2025
@benrr101benrr101 requested review froma team andCopilotMarch 26, 2025 17:30
Copy link
Contributor

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR merges the partial implementations of the SqlConfigurableRetryLogicLoader into a single common class while relocating the configuration interfaces into separate files.

  • Consolidated platform-specific implementations into a unified loader class.
  • Moved and separated configuration interfaces out of the manager file.
  • Removed redundant .NET Core and .NET Framework specific files.

Reviewed Changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
ISqlConfigurableRetryConnectionSection.csAdds interface for connection retry configuration.
IAppContextSwitchOverridesSection.csAdds interface for AppContext switch overrides.
ISqlConfigurableRetryCommandSection.csAdds interface for command retry configuration.
SqlConfigurableRetryLogicLoader.csConsolidates loader logic and implements new assembly resolution and type loading.
SqlConfigurableRetryLogicManager.csRemoves duplicated interface definitions.
SqlConfigurableRetryLogicManager.NetCoreApp.csRemoved redundant .NET Core-specific loader implementation.
SqlConfigurableRetryLogicManager.LoadType.csRemoved redundant .NET Framework-specific loader implementation.
Files not reviewed (2)
  • src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj: Language not supported
  • src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj: Language not supported
Comments suppressed due to low confidence (2)

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicLoader.cs:23

  • The removal of the 'partial' keyword consolidates the class into a single file. Please verify that no essential implementations from other partial class definitions are omitted.
internal sealed class SqlConfigurableRetryLogicLoader

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicLoader.cs:400

  • [nitpick] Consider using AppContext.BaseDirectory instead of Environment.CurrentDirectory in MakeFullPath to ensure a more reliable base path for assembly resolution.
string fullPath = Path.Combine(directory, assemblyName);

namespace Microsoft.Data.SqlClient
{
/// <summary>
/// Configurable retry logic loader
/// This class shouldn't throw exceptions;
/// All exceptions should be handled internally and logged with Event Source.
/// </summary>
internal sealedpartialclass SqlConfigurableRetryLogicLoader
internal sealed class SqlConfigurableRetryLogicLoader
Copy link
Contributor

Choose a reason for hiding this comment

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

The more I see partial classes, the more I dislike them. Maybe they're just misused a lot in this codebase, but I find them so confusing and troublesome.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I think they can be very useful, but they need to be sensibly used. I think partial classes, multiple classes in a single file, and filenames that don't correspond to the name of the class make this codebase more difficult to navigate and work on. It's something I want to incrementally resolve as I merge the projects.

In prior projects, I've used partial classes fairly successfully to split classes into logical divisions. Eg, writing an Antlr parser required a single class to handle all the nodes in the syntax tree, so having multiple partial classes to handle logical groupings of node handlers was a necessity. In this project, we have some classes that are so large (my) IDE refuses to do inspection or autocomplete on it (eg, TdsParser). If we have any hope of working on it, we'll likely need to split these up either into multiple classes or into partials.

Anyways ... I digress.

edwardneal reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

From the docshere, the first 'desirable' example is questionable (If you need 2 people in the same file at the same time, maybe you have bigger problems?), and the other 2 examples relate to code generation. I get the feeling partials were added to make development of other MS frameworks easier.

Another somewhat interesting read is here:https://stackoverflow.com/questions/3601901/when-is-it-appropriate-to-use-c-sharp-partial-classes

IMO, if your class is "too big" for a single file, then you need to re-design your class. Sometimes artifically splitting up responsibilities is for the best, even if naturally they're all the domain of a single encapsulation.

OTOH, partialmembers might be useful for reference packages. Perhaps we declare everything as partial in our ref assembly, and don't provide any definitions. Would that eliminate the need for the "throw" pattern? Food for thought.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@paulmedynski the first desirable sounds more like a holdover from the days of centralized source control (which Microsoft has much history) where having files checked out by multiple people isn't really feasible. I think if youcan't comfortably have two engineers in the same file at the same time, you've got bigger problems :)

I don't really subscribe to the "if your class/method is too big you're doing it wrong" school of thought. I think sometimes it makes sense to artificially split things up, sometimes it doesn't. But I see it more of an artform. I'm sure you'll correct me if you think my PRs are bad :P

@codecovCodecov
Copy link

codecovbot commentedMar 26, 2025
edited
Loading

Codecov Report

Attention: Patch coverage is98.00000% with1 line in your changes missing coverage. Please review.

Project coverage is 72.76%. Comparing base(1247ca4) to head(18ee367).
Report is 8 commits behind head on main.

Files with missing linesPatch %Lines
...ent/Reliability/SqlConfigurableRetryLogicLoader.cs98.00%1 Missing⚠️
Additional details and impacted files
@@            Coverage Diff             @@##             main    #3246      +/-   ##==========================================+ Coverage   72.69%   72.76%   +0.06%==========================================  Files         303      298       -5       Lines       59718    59612     -106     ==========================================- Hits        43414    43377      -37+ Misses      16304    16235      -69
FlagCoverage Δ
addons92.58% <ø> (ø)
netcore75.24% <97.77%> (+0.13%)⬆️
netfx71.37% <100.00%> (-0.02%)⬇️

Flags with carried forward coverage won't be shown.Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@paulmedynskipaulmedynski self-assigned thisMar 27, 2025
@benrr101benrr101 merged commitb2ee435 intomainMar 27, 2025
252 checks passed
@benrr101benrr101 deleted the dev/russellben/merge/sqlconfigurableretrylogicmanager branchMarch 27, 2025 19:11
@cheenamalhotracheenamalhotra added this to the6.1-preview1 milestoneMar 28, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@mdaiglemdaiglemdaigle approved these changes

@cheenamalhotracheenamalhotracheenamalhotra approved these changes

@paulmedynskipaulmedynskipaulmedynski approved these changes

Assignees

@paulmedynskipaulmedynski

Labels
Common Project 🚮Things that relate to the common project project
Projects
None yet
Milestone
6.1-preview1
Development

Successfully merging this pull request may close these issues.

4 participants
@benrr101@mdaigle@cheenamalhotra@paulmedynski

[8]ページ先頭

©2009-2025 Movatter.jp