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 | SqlClientPermission#3262

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
benrr101 merged 9 commits intomainfromdev/russellben/merge/sqlclientpermission
May 6, 2025

Conversation

benrr101
Copy link
Contributor

Description: This change is a bit heavier than it should be because of reasons...

  • Move SqlClientPermission from netfx project to common project
  • Separate SqlClientPermissionAttribute from the SqlClientPermission file into its own file in the common project
  • Move NameValuePermission into SqlClientPermission class, as a subclass
    • This class is only used for SqlClientPermission, and I really didn't like it hanging out in the middle by itself.
  • Applied some reorg/cleanup of SqlClientPermission
    • I would have gone further with this, but because this class overrides most of the base implementation (System.Data.Common.DBDataPermission), it's a bit more difficult to untangle.
  • Removed XML encode and decode methods
    • This is available via built-in methods, so it is not ideal to write our own.

Testing: For the most past, there are no functional changes. Code is moved around. CI should validate.

@benrr101benrr101 added the Common Project 🚮Things that relate to the common project project labelApr 8, 2025
@benrr101benrr101 requested review froma team andCopilotApril 8, 2025 18:51
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.

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj: Language not supported

@codecovCodecov
Copy link

codecovbot commentedApr 10, 2025
edited
Loading

Codecov Report

Attention: Patch coverage is35.24904% with169 lines in your changes missing coverage. Please review.

Project coverage is 73.03%. Comparing base(c5e3c40) to head(beb9014).
Report is 25 commits behind head on main.

Files with missing linesPatch %Lines
...rosoft/Data/SqlClient/SqlClientPermission.netfx.cs35.65%166 Missing⚠️
...ta/SqlClient/SqlClientPermissionAttribute.netfx.cs0.00%3 Missing⚠️
Additional details and impacted files
@@            Coverage Diff             @@##             main    #3262      +/-   ##==========================================+ Coverage   72.98%   73.03%   +0.04%==========================================  Files         299      299                Lines       57215    57194      -21     ==========================================+ Hits        41760    41770      +10+ Misses      15455    15424      -31
FlagCoverage Δ
addons92.58% <ø> (ø)
netcore75.27% <ø> (+0.08%)⬆️
netfx71.43% <35.24%> (-0.06%)⬇️

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.

@benrr101benrr101 added this to the6.1-preview2 milestoneApr 29, 2025
@cheenamalhotracheenamalhotra requested review fromcheenamalhotra anda teamMay 1, 2025 16:22
Comment on lines +25 to +28
public override IPermission CreatePermission()
{
return new SqlClientPermission(this);
}

Choose a reason for hiding this comment

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

Suggested change
publicoverrideIPermissionCreatePermission()
{
returnnewSqlClientPermission(this);
}
publicoverrideIPermissionCreatePermission()=>newSqlClientPermission(this);


private bool _IsUnrestricted
{
get

Choose a reason for hiding this comment

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

get => base.IsUnrestricted();

Copy link
Contributor

Choose a reason for hiding this comment

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

Personally, I like function bodies enclosed in braces. And in this case, it matches the format of the sibling setter. The => notation increases code density, which isn't necessarily a good thing. Personal preference I guess.

Comment on lines +114 to +117
public override IPermission Copy()
{
return new SqlClientPermission(this);
}

Choose a reason for hiding this comment

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

Suggested change
publicoverrideIPermissionCopy()
{
returnnewSqlClientPermission(this);
}
publicoverrideIPermissionCopy()=>newSqlClientPermission(this);

Comment on lines +588 to +591
internal NameValuePermission CopyNameValue()
{
return new NameValuePermission(this);
}

Choose a reason for hiding this comment

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

Suggested change
internalNameValuePermissionCopyNameValue()
{
returnnewNameValuePermission(this);
}
internalNameValuePermissionCopyNameValue()=>newNameValuePermission(this);


private bool _IsUnrestricted
{
get
Copy link
Contributor

Choose a reason for hiding this comment

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

Personally, I like function bodies enclosed in braces. And in this case, it matches the format of the sibling setter. The => notation increases code density, which isn't necessarily a good thing. Personal preference I guess.

}

string unrestrictedValue = securityElement.Attribute(XmlStr._Unrestricted);
_IsUnrestricted = unrestrictedValue != null && bool.Parse(unrestrictedValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just FYI, but this seemingly benign assignment can (surprisingly) throw reflection exceptions, which we don't document. In fact, the docs don't claim this function will throw anything!

@benrr101benrr101 merged commit516b402 intomainMay 6, 2025
251 checks passed
@benrr101benrr101 deleted the dev/russellben/merge/sqlclientpermission branchMay 6, 2025 17:36
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mdaiglemdaiglemdaigle left review comments

@edwardnealedwardnealedwardneal left review comments

Copilot code reviewCopilotCopilot left review comments

@cheenamalhotracheenamalhotracheenamalhotra approved these changes

@paulmedynskipaulmedynskipaulmedynski approved these changes

Assignees
No one assigned
Labels
Common Project 🚮Things that relate to the common project project
Projects
None yet
Milestone
6.1-preview2
Development

Successfully merging this pull request may close these issues.

5 participants
@benrr101@mdaigle@cheenamalhotra@paulmedynski@edwardneal

[8]ページ先頭

©2009-2025 Movatter.jp