-
Notifications
You must be signed in to change notification settings - Fork 299
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 support for aliases on netcore+Windows #1588
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7198273
Add support for aliases on netcore+Windows
David-Engel 8d85c79
Add test
David-Engel 9b83392
Revert spacing
David-Engel fb98b36
Better partition Windows/Unix code
David-Engel a463400
Add missing files
David-Engel 990809f
Fix attempt
David-Engel 2975144
Re-work new test
David-Engel 3694397
Applying review suggestions
David-Engel d732366
Merge branch 'main' of https://github.com/dotnet/SqlClient into aliases
David-Engel 55aff92
Deduplicate code
David-Engel f138c0d
Merge branch 'main' into aliases
DavoudEshtehari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.Unix.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Microsoft.Data.Common | ||
{ | ||
/// <summary> | ||
/// The class ADP defines the exceptions that are specific to the Adapters. | ||
/// The class contains functions that take the proper informational variables and then construct | ||
/// the appropriate exception with an error string obtained from the resource framework. | ||
/// The exception is then returned to the caller, so that the caller may then throw from its | ||
/// location so that the catcher of the exception will have the appropriate call stack. | ||
/// This class is used so that there will be compile time checking of error messages. | ||
/// The resource Framework.txt will ensure proper string text based on the appropriate locale. | ||
/// </summary> | ||
internal static partial class ADP | ||
{ | ||
internal static object LocalMachineRegistryValue(string subkey, string queryvalue) | ||
{ | ||
// No registry in non-Windows environments | ||
return null; | ||
} | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.Windows.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Runtime.InteropServices; | ||
using System.Runtime.Versioning; | ||
using System.Security; | ||
using System.Security.Permissions; | ||
using Microsoft.Win32; | ||
|
||
namespace Microsoft.Data.Common | ||
{ | ||
/// <summary> | ||
/// The class ADP defines the exceptions that are specific to the Adapters. | ||
/// The class contains functions that take the proper informational variables and then construct | ||
/// the appropriate exception with an error string obtained from the resource framework. | ||
/// The exception is then returned to the caller, so that the caller may then throw from its | ||
/// location so that the catcher of the exception will have the appropriate call stack. | ||
/// This class is used so that there will be compile time checking of error messages. | ||
/// The resource Framework.txt will ensure proper string text based on the appropriate locale. | ||
/// </summary> | ||
internal static partial class ADP | ||
{ | ||
[ResourceExposure(ResourceScope.Machine)] | ||
[ResourceConsumption(ResourceScope.Machine)] | ||
internal static object LocalMachineRegistryValue(string subkey, string queryvalue) | ||
{ // MDAC 77697 | ||
(new RegistryPermission(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\\" + subkey)).Assert(); // MDAC 62028 | ||
try | ||
{ | ||
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(subkey, false)) | ||
{ | ||
return key?.GetValue(queryvalue); | ||
} | ||
} | ||
catch (SecurityException e) | ||
{ | ||
// Even though we assert permission - it's possible there are | ||
// ACL's on registry that cause SecurityException to be thrown. | ||
ADP.TraceExceptionWithoutRethrow(e); | ||
return null; | ||
} | ||
finally | ||
{ | ||
RegistryPermission.RevertAssert(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff is a bit misleading. This "deleted" section simply moved down and the NetLib code moved up so that the NetLib code is available on netcore.