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

Commitbb8006c

Browse files
committed
Rollup of feedback from Batch 1 PR
1 parentcf92a05 commitbb8006c

File tree

6 files changed

+30
-35
lines changed

6 files changed

+30
-35
lines changed

‎doc/snippets/Microsoft.Data.SqlClient/PoolBlockingPeriod.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<value>1</value>
1414
</AlwaysBlock>
1515
<NeverBlock>
16-
<summary>Blocking period OFF forAzure SQL servers,but ON for all other SQL servers.</summary>
16+
<summary>Blocking period OFF forall SQL servers,including Azure SQL servers.</summary>
1717
<value>2</value>
1818
</NeverBlock>
1919
</members>

‎doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationInitializer.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
<membersname="SqlAuthenticationInitializer">
33
<SqlAuthenticationInitializer>
44
<summary>
5-
Calledfrom constructors in derived classes to initializethe <seecref="T:Microsoft.Data.SqlClient.SqlAuthenticationInitializer" />class.
5+
Calledduring instantiation ofthefirst<seecref="T:Microsoft.Data.SqlClient.SqlConnection" />instance.
66
</summary>
77
</SqlAuthenticationInitializer>
88
<ctor>
99
<summary>
10-
DefaultConstructor toinitialize the <seecref="T:Microsoft.Data.SqlClient.SqlAuthenticationInitializer" /> class.
10+
Defaultconstructor toinstantiate the <seecref="T:Microsoft.Data.SqlClient.SqlAuthenticationInitializer" /> class.
1111
</summary>
1212
</ctor>
1313
<Initialize>
1414
<summary>
15-
When overridden in a derived class, initializes the authentication initializer. This method is calledbythe <seecref="M:Microsoft.Data.SqlClient.SqlAuthenticationInitializer.#ctor" /> constructor duringstartup.
15+
When overridden in a derived class, initializes the authentication initializer. This method is calledimmediately afterthe <seecref="M:Microsoft.Data.SqlClient.SqlAuthenticationInitializer.#ctor" /> constructor duringinstantiation of the first <seecref="T:Microsoft.Data.SqlClient.SqlConnection" /> instance.
1616
</summary>
1717
</Initialize>
1818
</members>

‎doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationMethod.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<docs>
22
<membersname="SqlAuthenticationMethod">
33
<SqlAuthenticationMethod>
4-
<summary>Describes the different SQL authentication methods that can be used by a client connecting to Azure SQL Database. For details, see <seehref="https://docs.microsoft.com/azure/sql-database/sql-database-aad-authentication">Connecting to SQL Database By Using Azure Active Directory Authentication</see>.</summary>
4+
<summary>Describes the different SQL authentication methods that can be used by a client connecting to Azure SQL Database. For details, see <seehref="https://learn.microsoft.com/azure/azure-sql/database/authentication-aad-overview">Use Microsoft Entra Authentication</see>.</summary>
55
</SqlAuthenticationMethod>
66
<NotSpecified>
77
<summary>The authentication method is not specified.</summary>
88
<value>0</value>
99
</NotSpecified>
1010
<SqlPassword>
11-
<summary>The authentication methodis Sql Password.</summary>
11+
<summary>The authentication methoduses Sql Password. Use Sql Password to connect to a SQL Database using SQL Server authentication.</summary>
1212
<value>1</value>
1313
</SqlPassword>
1414
<ActiveDirectoryPassword>
15-
<summary>The authentication method uses Active Directory Password. Use Active Directory Password to connect to a SQL Database usingan Azure AD principal name and password.</summary>
15+
<summary>The authentication method uses Active Directory Password. Use Active Directory Password to connect to a SQL Database usinga Microsoft Entra principal name and password.</summary>
1616
<value>2</value>
1717
</ActiveDirectoryPassword>
1818
<ActiveDirectoryIntegrated>

‎doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationProvider.xml

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,34 @@
2323
{
2424
public override async Task&lt;SqlAuthenticationToken&gt; AcquireTokenAsync(SqlAuthenticationParameters parameters)
2525
{
26-
stringclientId = "my-client-id";
27-
stringclientName = "My Application Name";
28-
strings_defaultScopeSuffix = "/.default";
29-
30-
string[] scopes =new string[] {parameters.Resource.EndsWith(s_defaultScopeSuffix) ? parameters.Resource : parameters.Resource +s_defaultScopeSuffix };
31-
32-
IPublicClientApplication app = PublicClientApplicationBuilder.Create(clientId)
26+
conststringClientId = "my-client-id";
27+
conststringClientName = "My Application Name";
28+
conststringDefaultScopeSuffix = "/.default";
29+
30+
string[] scopes =[parameters.Resource.EndsWith(DefaultScopeSuffix) ? parameters.Resource : parameters.Resource +DefaultScopeSuffix ];
31+
32+
IPublicClientApplication app = PublicClientApplicationBuilder.Create(ClientId)
3333
.WithAuthority(parameters.Authority)
34-
.WithClientName(clientName)
34+
.WithClientName(ClientName)
3535
.WithRedirectUri("https://login.microsoftonline.com/common/oauth2/nativeclient")
3636
.Build();
37-
38-
AuthenticationResult result = await app.AcquireTokenWithDeviceCode(scopes,
39-
deviceCodeResult => CustomDeviceFlowCallback(deviceCodeResult)).ExecuteAsync();
37+
using CancellationTokenSource connectionTimeoutCancellation = new CancellationTokenSource(TimeSpan.FromSeconds(parameters.ConnectionTimeout));
38+
39+
AuthenticationResult result = await app.AcquireTokenWithDeviceCode(scopes, CustomDeviceFlowCallback)
40+
.ExecuteAsync(connectionTimeoutCancellation.Token);
4041
return new SqlAuthenticationToken(result.AccessToken, result.ExpiresOn);
4142
}
42-
43+
4344
public override bool IsSupported(SqlAuthenticationMethod authenticationMethod) =>
4445
authenticationMethod.Equals(SqlAuthenticationMethod.ActiveDirectoryDeviceCodeFlow);
45-
46+
4647
private Task CustomDeviceFlowCallback(DeviceCodeResult result)
4748
{
4849
Console.WriteLine(result.Message);
49-
return Task.FromResult(0);
50+
return Task.CompletedTask;
5051
}
5152
}
52-
53+
5354
public class Program
5455
{
5556
public static void Main()
@@ -87,16 +88,16 @@
8788
</SetProvider>
8889
<BeforeLoad>
8990
<paramname="authenticationMethod">The authentication method.</param>
90-
<summary>This method is called immediately before the provider is added to SQLdrivers registry.</summary>
91+
<summary>This method is called immediately before the provider is added to SQLauthentication provider registry.</summary>
9192
<remarks>
9293
Avoid performing long-waiting tasks in this method, since it can block other threads from accessing the provider registry.
9394
</remarks>
9495
</BeforeLoad>
9596
<BeforeUnload>
9697
<paramname="authenticationMethod">The authentication method.</param>
97-
<summary>This method is called immediately before the provider is removed from the SQLdrivers registry.</summary>
98+
<summary>This method is called immediately before the provider is removed from the SQLauthentication provider registry.</summary>
9899
<remarks>
99-
For example, this method is called when a different provider with the same authentication method overrides this provider in the SQLdrivers registry. Avoid performing long-waiting task in this method, since it can block other threads from accessing the provider registry.
100+
For example, this method is called when a different provider with the same authentication method overrides this provider in the SQLauthentication provider registry. Avoid performing long-waiting task in this method, since it can block other threads from accessing the provider registry.
100101
</remarks>
101102
</BeforeUnload>
102103
<IsSupported>

‎doc/snippets/Microsoft.Data.SqlClient/SqlAuthenticationToken.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<docs>
22
<membersname="SqlAuthenticationToken">
33
<SqlAuthenticationToken>
4-
<summary>Represents anADauthentication token.</summary>
4+
<summary>Represents an authentication token.</summary>
55
</SqlAuthenticationToken>
66
<ctor>
77
<paramname="accessToken">The access token.</param>

‎doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
using var connection = new SqlConnection(connString);
153153
connection.Open();
154154

155-
var batch = new SqlBatch(connection);
155+
usingvar batch = new SqlBatch(connection);
156156

157157
const int count = 10;
158158
const string parameterName = "parameter";
@@ -163,9 +163,6 @@
163163
batch.BatchCommands.Add(batchCommand);
164164
}
165165

166-
// Optionally Prepare
167-
batch.Prepare();
168-
169166
var results = new List&lt;int&gt;(count);
170167
using (SqlDataReader reader = batch.ExecuteReader())
171168
{
@@ -185,7 +182,7 @@
185182
</BatchCommands>
186183
<Commands>
187184
<summary>
188-
The list of commands contained in the batch in a <seecref="T:System.Collections.IList" /> of <seecref="T:Microsoft.Data.SqlClient.SqlBatchCommand" /> objects.
185+
The list of commands contained in the batch in a <seecref="T:System.Collections.Generic.List{Microsoft.Data.SqlClient.SqlBatchCommand}" />.
189186
</summary>
190187
</Commands>
191188
<ExecuteReader>
@@ -213,7 +210,7 @@
213210
using var connection = new SqlConnection(connString);
214211
connection.Open();
215212

216-
var batch = new SqlBatch(connection);
213+
usingvar batch = new SqlBatch(connection);
217214

218215
const int count = 10;
219216
const string parameterName = "parameter";
@@ -224,9 +221,6 @@
224221
batch.BatchCommands.Add(batchCommand);
225222
}
226223

227-
// Optionally Prepare
228-
batch.Prepare();
229-
230224
var results = new List&lt;int&gt;(count);
231225
using (SqlDataReader reader = batch.ExecuteReader())
232226
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp