Skip to content
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

Merge main into live #10891

Merged
merged 3 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Net.Http;
using System.Threading.Tasks;

namespace HttpCompletionOptionSnippets
{
class HttpCompletionOptionSnippets
{
public static async Task RunAsync()
{
//<SnippetHttpCompletionOption>
using var httpClient = new HttpClient();
httpClient.Timeout = TimeSpan.FromSeconds(30);
httpClient.MaxResponseContentBufferSize = 1_000; // This will be ignored

// Because we're specifying the ResponseHeadersRead option,
// the 30-second timeout applies only up until the headers are received.
// It does not affect future operations that interact with the response content.
using HttpResponseMessage response = await httpClient.GetAsync(
"http://localhost:12345/",
HttpCompletionOption.ResponseHeadersRead);

// Do other checks that don't rely on the content first, like status code validation.
response.EnsureSuccessStatusCode();

// Since the HttpClient.Timeout will not apply to reading the content,
// you must enforce it yourself, for example by using a CancellationTokenSource.
using var cancellationSource = new CancellationTokenSource(TimeSpan.FromSeconds(15));

// If you wish to enforce the MaxResponseContentBufferSize limit as well,
// you can do so by calling the LoadIntoBufferAsync helper first.
await response.Content.LoadIntoBufferAsync(1_000, cancellationSource.Token);

// Make sure to pass the CancellationToken to all methods.
string content = await response.Content.ReadAsStringAsync(cancellationSource.Token);
//</SnippetHttpCompletionOption>
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
15 changes: 15 additions & 0 deletions snippets/csharp/System.Net.Http/HttpCompletionOption/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;

namespace HttpCompletionOptionSnippets
{
class MetadataReaderSnippets
{
class Program
{
static async Task Main()
{
await HttpCompletionOptionSnippets.RunAsync();
}
}
}
}
24 changes: 11 additions & 13 deletions xml/Microsoft.SqlServer.Server/SqlMetaData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,17 @@

The following are the default values assigned to `dbType`, depending on the `SqlDbType` (the <xref:Microsoft.SqlServer.Server.SqlMetaData.XmlSchemaCollectionDatabase%2A>, <xref:Microsoft.SqlServer.Server.SqlMetaData.XmlSchemaCollectionName%2A>, <xref:Microsoft.SqlServer.Server.SqlMetaData.XmlSchemaCollectionOwningSchema%2A>, and <xref:Microsoft.SqlServer.Server.SqlMetaData.Type%2A> properties are set to `null`):

|SqlDbType|Precision|Scale|Locale|Compare options|
|---------------|---------------|-----------|------------|---------------------|
|Binary|0|0|0|IgnoreCase, IgnoreKanaType, IgnoreWidth|
|Char|0|0|\<thread>|IgnoreCase, IgnoreKanaType, IgnoreWidth|
|Image|0|0|0|None|
|NChar|0|0|\<thread>|IgnoreCase, IgnoreKanaType, IgnoreWidth|
|NText|0|0|\<thread>|IgnoreCase, IgnoreKanaType, IgnoreWidth|
|NVarChar|0|0|\<thread>|IgnoreCase, IgnoreKanaType, IgnoreWidth|
|Text|0|0|\<thread>|IgnoreCase, IgnoreKanaType, IgnoreWidth|
|VarBinary|0|0||IgnoreCase, IgnoreKanaType, IgnoreWidth|
|VarChar|0|0|\<thread>|IgnoreCase, IgnoreKanaType, IgnoreWidth|


| SqlDbType | Precision | Scale | Locale | Compare options |
|-----------|-----------|-------|-----------|-----------------------------------------|
| Binary | 0 | 0 | 0 | IgnoreCase, IgnoreKanaType, IgnoreWidth |
| Char | 0 | 0 | \<thread> | IgnoreCase, IgnoreKanaType, IgnoreWidth |
| Image | 0 | 0 | 0 | None |
| NChar | 0 | 0 | \<thread> | IgnoreCase, IgnoreKanaType, IgnoreWidth |
| NText | 0 | 0 | \<thread> | IgnoreCase, IgnoreKanaType, IgnoreWidth |
| NVarChar | 0 | 0 | \<thread> | IgnoreCase, IgnoreKanaType, IgnoreWidth |
| Text | 0 | 0 | \<thread> | IgnoreCase, IgnoreKanaType, IgnoreWidth |
| VarBinary | 0 | 0 | | IgnoreCase, IgnoreKanaType, IgnoreWidth |
| VarChar | 0 | 0 | \<thread> | IgnoreCase, IgnoreKanaType, IgnoreWidth |

## Examples
The following example creates a new <xref:Microsoft.SqlServer.Server.SqlMetaData> object by specifying the column name, a column data type of <xref:System.Data.SqlDbType>`.NVarChar`, and a maximum length of 12 characters.
Expand Down
Loading