Skip to content

Commit 5f21926

Browse files
committed
Removing CDATA blocks, fixing cref links
1 parent 5aa0437 commit 5f21926

File tree

5 files changed

+205
-213
lines changed

5 files changed

+205
-213
lines changed

doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
<see langword="true" /> if the specified authentication method is supported; otherwise, <see langword="false" />.
179179
</returns>
180180
<remarks>
181-
The supported authentication modes with <see cref="Microsoft.Data.SqlClient.ActiveDirectoryAuthenticationProvider" /> are:
181+
The supported authentication modes with <see cref="T:Microsoft.Data.SqlClient.ActiveDirectoryAuthenticationProvider" /> are:
182182
<list type="bullet">
183183
<item>Active Directory Password</item>
184184
<item>Active Directory Integrated</item>

doc/snippets/Microsoft.Data.SqlClient/ApplicationIntent.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<members name="ApplicationIntent">
33
<ApplicationIntent>
44
<summary>
5-
Specifies a value for <see cref="P:Microsoft.Data.SqlClient.SqlConnectionStringBuilder.ApplicationIntent" />. Possible values are <see cref="Microsoft.Data.SqlClient.ApplicationIntent.ReadWrite" /> and <see cref="Microsoft.Data.SqlClient.ApplicationIntent.ReadOnly" />.
5+
Specifies a value for <see cref="P:Microsoft.Data.SqlClient.SqlConnectionStringBuilder.ApplicationIntent" />. Possible values are <see cref="F:Microsoft.Data.SqlClient.ApplicationIntent.ReadWrite" /> and <see cref="F:Microsoft.Data.SqlClient.ApplicationIntent.ReadOnly" />.
66
</summary>
77
</ApplicationIntent>
88
<ReadWrite>

doc/snippets/Microsoft.Data.SqlClient/OnChangeEventHandler.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Handles the <see cref="E:Microsoft.Data.SqlClient.SqlDependency.OnChange" /> event that is fired when a notification is received for any of the commands associated with a <see cref="T:Microsoft.Data.SqlClient.SqlDependency" /> object.
1010
</summary>
1111
<remarks>
12-
The <see cref="Microsoft.Data.SqlClient.SqlDependency.OnChange" /> event does not necessarily imply a change in the data. Other circumstances, such as time-out expired and failure to set the notification request, also generate <see cref="Microsoft.Data.SqlClient.SqlDependency.OnChange" />.
12+
The <see cref="E:Microsoft.Data.SqlClient.SqlDependency.OnChange" /> event does not necessarily imply a change in the data. Other circumstances, such as time-out expired and failure to set the notification request, also generate <see cref="E:Microsoft.Data.SqlClient.SqlDependency.OnChange" />.
1313
</remarks>
1414
</OnChangeEventHandler>
1515
</members>

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

Lines changed: 56 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -8,64 +8,62 @@
88
<example>
99
The following example demonstrates implementing a custom SqlAuthenticationProvider and providing the same to SqlClient for overriding Device Code Flow authentication mode:
1010
<code language="c#">
11-
<![CDATA[
12-
using System;
13-
using System.Threading.Tasks;
14-
using Microsoft.Identity.Client;
15-
using Microsoft.Data.SqlClient;
16-
17-
namespace CustomAuthenticationProviderExamples
18-
{
19-
/// summary>
20-
/// Example demonstrating creating a custom device code flow authentication provider and attaching it to the driver.
21-
/// This is helpful for applications that wish to override the Callback for the Device Code Result implemented by the SqlClient driver.
22-
/// </summary>
23-
public class CustomDeviceCodeFlowAzureAuthenticationProvider : SqlAuthenticationProvider
24-
{
25-
public override async Task<SqlAuthenticationToken> AcquireTokenAsync(SqlAuthenticationParameters parameters)
26-
{
27-
string clientId = "my-client-id";
28-
string clientName = "My Application Name";
29-
string s_defaultScopeSuffix = "/.default";
30-
31-
string[] scopes = new string[] { parameters.Resource.EndsWith(s_defaultScopeSuffix) ? parameters.Resource : parameters.Resource + s_defaultScopeSuffix };
32-
33-
IPublicClientApplication app = PublicClientApplicationBuilder.Create(clientId)
34-
.WithAuthority(parameters.Authority)
35-
.WithClientName(clientName)
36-
.WithRedirectUri("https://login.microsoftonline.com/common/oauth2/nativeclient")
37-
.Build();
38-
39-
AuthenticationResult result = await app.AcquireTokenWithDeviceCode(scopes,
40-
deviceCodeResult => CustomDeviceFlowCallback(deviceCodeResult)).ExecuteAsync();
41-
return new SqlAuthenticationToken(result.AccessToken, result.ExpiresOn);
42-
}
43-
44-
public override bool IsSupported(SqlAuthenticationMethod authenticationMethod) =>
45-
authenticationMethod.Equals(SqlAuthenticationMethod.ActiveDirectoryDeviceCodeFlow);
46-
47-
private Task CustomDeviceFlowCallback(DeviceCodeResult result)
48-
{
49-
Console.WriteLine(result.Message);
50-
return Task.FromResult(0);
51-
}
52-
}
53-
54-
public class Program
55-
{
56-
public static void Main()
57-
{
58-
// Register our custom authentication provider class to override Active Directory Device Code Flow
59-
SqlAuthenticationProvider.SetProvider(SqlAuthenticationMethod.ActiveDirectoryDeviceCodeFlow, new CustomDeviceCodeFlowAzureAuthenticationProvider());
60-
using (SqlConnection sqlConnection = new SqlConnection("Server=<myserver>.database.windows.net;Authentication=Active Directory Device Code Flow;Database=<db>;"))
61-
{
62-
sqlConnection.Open();
63-
Console.WriteLine("Connected successfully!");
64-
}
65-
}
66-
}
67-
}
68-
]]>
11+
using System;
12+
using System.Threading.Tasks;
13+
using Microsoft.Identity.Client;
14+
using Microsoft.Data.SqlClient;
15+
16+
namespace CustomAuthenticationProviderExamples
17+
{
18+
/// summary>
19+
/// Example demonstrating creating a custom device code flow authentication provider and attaching it to the driver.
20+
/// This is helpful for applications that wish to override the Callback for the Device Code Result implemented by the SqlClient driver.
21+
/// &lt;/summary&gt;
22+
public class CustomDeviceCodeFlowAzureAuthenticationProvider : SqlAuthenticationProvider
23+
{
24+
public override async Task&lt;SqlAuthenticationToken&gt; AcquireTokenAsync(SqlAuthenticationParameters parameters)
25+
{
26+
string clientId = "my-client-id";
27+
string clientName = "My Application Name";
28+
string s_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)
33+
.WithAuthority(parameters.Authority)
34+
.WithClientName(clientName)
35+
.WithRedirectUri("https://login.microsoftonline.com/common/oauth2/nativeclient")
36+
.Build();
37+
38+
AuthenticationResult result = await app.AcquireTokenWithDeviceCode(scopes,
39+
deviceCodeResult => CustomDeviceFlowCallback(deviceCodeResult)).ExecuteAsync();
40+
return new SqlAuthenticationToken(result.AccessToken, result.ExpiresOn);
41+
}
42+
43+
public override bool IsSupported(SqlAuthenticationMethod authenticationMethod) =>
44+
authenticationMethod.Equals(SqlAuthenticationMethod.ActiveDirectoryDeviceCodeFlow);
45+
46+
private Task CustomDeviceFlowCallback(DeviceCodeResult result)
47+
{
48+
Console.WriteLine(result.Message);
49+
return Task.FromResult(0);
50+
}
51+
}
52+
53+
public class Program
54+
{
55+
public static void Main()
56+
{
57+
// Register our custom authentication provider class to override Active Directory Device Code Flow
58+
SqlAuthenticationProvider.SetProvider(SqlAuthenticationMethod.ActiveDirectoryDeviceCodeFlow, new CustomDeviceCodeFlowAzureAuthenticationProvider());
59+
using (SqlConnection sqlConnection = new SqlConnection("Server=&lt;myserver&gt;.database.windows.net;Authentication=Active Directory Device Code Flow;Database=&lt;db&gt;;"))
60+
{
61+
sqlConnection.Open();
62+
Console.WriteLine("Connected successfully!");
63+
}
64+
}
65+
}
66+
}
6967
</code>
7068
</example>
7169
</SqlAuthenticationProvider>

0 commit comments

Comments
 (0)