Skip to content

Commit

Permalink
Merge branch 'main' into Issue_1579_th-TH_CultureInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
arellegue authored Jun 27, 2023
2 parents 26c7ead + 3ffc4f6 commit 7e3a257
Show file tree
Hide file tree
Showing 62 changed files with 1,134 additions and 588 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Preview Release 5.2.0-preview2.23159.1] - 2023-06-08

This update brings the below changes over the previous release:

### Added

- Added new property `RowsCopied64` to `SqlBulkCopy`. [#2004](https://github.com/dotnet/SqlClient/pull/2004)

### Fixed

- Fixed socket synchronization issue during connect in managed SNI. [#1029](https://github.com/dotnet/SqlClient/pull/1029)
- Fixed issue with `SqlConnectionStringBuilder` property indexer not supporting non-string values. [#2018](https://github.com/dotnet/SqlClient/pull/2018)

### Changed

- Moved to new System.Data.SqlTypes APIs in **.NET 7** and upper. [1934](https://github.com/dotnet/SqlClient/pull/1934) and [#1981](https://github.com/dotnet/SqlClient/pull/1981)
- Changed **[UseOneSecFloorInTimeoutCalculationDuringLogin](https://learn.microsoft.com/sql/connect/ado-net/appcontext-switches#enable-a-minimum-timeout-during-login)** App Context switch default to **true** and extended its effect to .NET and .NET Standard. [#2012](https://github.com/dotnet/SqlClient/pull/2012)
- Updated `Microsoft.Identity.Client` version from 4.47.2 to 4.53.0. [#2031](https://github.com/dotnet/SqlClient/pull/2031), [#2055](https://github.com/dotnet/SqlClient/pull/2055)
- Code health improvement: [#1985](https://github.com/dotnet/SqlClient/pull/1985)

## [Preview Release 5.2.0-preview1.23109.1] - 2023-04-20

This update brings the below changes over the previous release:
Expand Down
35 changes: 35 additions & 0 deletions doc/samples/SqlConnection_AccessTokenCallback.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Data;
// <Snippet1>
using Microsoft.Data.SqlClient;
using Azure.Identity;

class Program
{
static void Main()
{
OpenSqlConnection();
Console.ReadLine();
}

private static void OpenSqlConnection()
{
string connectionString = GetConnectionString();
using (SqlConnection connection = new SqlConnection("Data Source=contoso.database.windows.net;Initial Catalog=AdventureWorks;")
{
AccessTokenCallback = async (authParams, cancellationToken) =>
{
var cred = new DefaultAzureCredential();
string scope = authParams.Resource.EndsWith(s_defaultScopeSuffix) ? authParams.Resource : authParams.Resource + s_defaultScopeSuffix;
var token = await cred.GetTokenAsync(new TokenRequestContext(new[] { scope }), cancellationToken);
return new SqlAuthenticationToken(token.Token, token.ExpiresOn);
}
})
{
connection.Open();
Console.WriteLine("ServerVersion: {0}", connection.ServerVersion);
Console.WriteLine("State: {0}", connection.State);
}
}
}
// </Snippet1>
16 changes: 16 additions & 0 deletions doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,22 @@ using (SqlConnection connection = new SqlConnection(connectionString))
<value>The access token for the connection.</value>
<remarks>To be added.</remarks>
</AccessToken>
<AccessTokenCallback>
<summary>Gets or sets the access token callback for the connection.</summary>
<value>
The Func that takes a <see cref="SqlAuthenticationParameters" /> and <see cref="System.Threading.CancellationToken" /> and returns a <see cref="SqlAuthenticationToken" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example demonstrates how to define and set an <xref:Microsoft.Data.SqlClient.AccessTokenCallback>.
[!code-csharp[SqlConnection_AccessTokenCallback Example#1](~/../sqlclient/doc/samples/SqlConnection_AccessTokenCallback.cs#1)]
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The AccessTokenCallback is combined with other conflicting authentication configurations.</exception>
</AccessTokenCallback>
<BeginDbTransaction>
<param name="isolationLevel">To be added.</param>
<summary>To be added.</summary>
Expand Down
116 changes: 116 additions & 0 deletions release-notes/5.2/5.2.0-preview2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Release Notes

## [Preview Release 5.2.0-preview2.23159.1] - 2023-06-08

This update brings the below changes over the previous release:

### Added

- Added new property `RowsCopied64` to `SqlBulkCopy`. [#2004](https://github.com/dotnet/SqlClient/pull/2004) [Read more](#added-new-property-rowscopied64-to-sqlbulkcopy)

### Fixed

- Fixed socket synchronization issue during connect in managed SNI. [#1029](https://github.com/dotnet/SqlClient/pull/1029)
- Fixed issue with `SqlConnectionStringBuilder` property indexer not supporting non-string values. [#2018](https://github.com/dotnet/SqlClient/pull/2018)

### Changed

- Moved to new System.Data.SqlTypes APIs in **.NET 7** and upper. [1934](https://github.com/dotnet/SqlClient/pull/1934) and [#1981](https://github.com/dotnet/SqlClient/pull/1981)
- Changed **[UseOneSecFloorInTimeoutCalculationDuringLogin](https://learn.microsoft.com/sql/connect/ado-net/appcontext-switches#enable-a-minimum-timeout-during-login)** App Context switch default to **true** and extended its effect to .NET and .NET Standard. [#2012](https://github.com/dotnet/SqlClient/pull/2012)
- Updated `Microsoft.Identity.Client` version from 4.47.2 to 4.53.0. [#2031](https://github.com/dotnet/SqlClient/pull/2031), [#2055](https://github.com/dotnet/SqlClient/pull/2055)
- Code health improvement: [#1985](https://github.com/dotnet/SqlClient/pull/1985)

## New features over preview release v5.2.0-preview1

### Added new property `RowsCopied64` to SqlBulkCopy

SqlBulkCopy has a new property `RowsCopied64` which supports `long` value types.

**Note that the existing `SqlBulkCopy.RowsCopied` behavior is unchanged. When the value exceeds `int.MaxValue`, `RowsCopied` can return a negative number.**

Example usage:

```C#
using (SqlConnection srcConn = new SqlConnection(srcConstr))
using (SqlCommand srcCmd = new SqlCommand("select top 5 * from employees", srcConn))
{
srcConn.Open();
using (DbDataReader reader = srcCmd.ExecuteReader())
{
using (SqlBulkCopy bulkcopy = new SqlBulkCopy(dstConn))
{
bulkcopy.DestinationTableName = dstTable;
SqlBulkCopyColumnMappingCollection ColumnMappings = bulkcopy.ColumnMappings;

ColumnMappings.Add("EmployeeID", "col1");
ColumnMappings.Add("LastName", "col2");
ColumnMappings.Add("FirstName", "col3");

bulkcopy.WriteToServer(reader);
long rowsCopied = bulkcopy.RowsCopied64;
}
}
}
```

## Target Platform Support

- .NET Framework 4.6.2+ (Windows x86, Windows x64)
- .NET 6.0+ (Windows x86, Windows x64, Windows ARM64, Windows ARM, Linux, macOS)
- .NET Standard 2.0+ (Windows x86, Windows x64, Windows ARM64, Windows ARM, Linux, macOS)

### Dependencies

#### .NET Framework

- Microsoft.Data.SqlClient.SNI 5.1.0
- Azure.Identity 1.8.0
- Microsoft.Identity.Client 4.53.0
- Microsoft.IdentityModel.JsonWebTokens 6.24.0
- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
- System.Buffers 4.5.1
- System.Configuration.ConfigurationManager 6.0.1
- System.IO 4.3.0
- System.Runtime.InteropServices.RuntimeInformation 4.3.0
- System.Security.Cryptography.Algorithms 4.3.1
- System.Security.Cryptography.Primitives 4.3.0
- System.Text.Encoding.Web 6.0.0

#### .NET

- Microsoft.Data.SqlClient.SNI 5.1.0
- Azure.Identity 1.8.0
- Microsoft.Identity.Client 4.53.0
- Microsoft.IdentityModel.JsonWebTokens 6.24.0
- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
- Microsoft.SqlServer.Server 1.0.0
- System.Buffers 4.5.1
- System.Configuration.ConfigurationManager 6.0.1
- System.Diagnostics.DiagnosticSource 6.0.0
- System.IO 4.3.0
- System.Runtime.Caching 6.0.0
- System.Text.Encoding.CodePages 6.0.0
- System.Text.Encodings.Web 6.0.0
- System.Resources.ResourceManager 4.3.0
- System.Security.Cryptography.Cng 5.0.0
- System.Security.Principal.Windows 5.0.0

#### .NET Standard

- Microsoft.Data.SqlClient.SNI 5.1.0
- Azure.Identity 1.6.0
- Microsoft.Identity.Client 4.53.0
- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
- Microsoft.IdentityModel.JsonWebTokens 6.24.0
- Microsoft.SqlServer.Server 1.0.0
- Microsoft.Win32.Registry 5.0.0
- System.Buffers 4.5.1
- System.Configuration.ConfigurationManager 6.0.1
- System.IO 4.3.0
- System.Runtime.Caching 6.0.0
- System.Text.Encoding.CodePages 6.0.0
- System.Text.Encodings.Web 6.0.0
- System.Runtime.Loader 4.3.0
- System.Resources.ResourceManager 4.3.0
- System.Security.Cryptography.Cng 5.0.0
- System.Security.Principal.Windows 5.0.0
1 change: 1 addition & 0 deletions release-notes/5.2/5.2.0.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
| Release Date | Version | Notes |
| :-- | :-- | :--: |
| 2023/06/08 | 5.2.0-preview2.23159.1 | [relese notes](5.2.0-preview2.md) |
| 2023/04/20 | 5.2.0-preview1.23109.1 | [release notes](5.2.0-preview1.md) |
5 changes: 5 additions & 0 deletions release-notes/5.2/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Microsoft.Data.SqlClient 5.2 Releases

The following Microsoft.Data.SqlClient 5.2 preview releases have been shipped:

| Release Date | Version | Notes |
| :-- | :-- | :--: |
| 2023/06/08 | 5.2.0-preview2.23159.1 | [release notes](5.2.0-preview2.md) |
| 2023/04/20 | 5.2.0-preview1.23109.1 | [release notes](5.2.0-preview1.md) |
1 change: 1 addition & 0 deletions release-notes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ The latest stable release is [Microsoft.Data.SqlClient 5.1](5.1).

## Release Information

- [Microsoft.Data.SqlClient 5.2](5.2)
- [Microsoft.Data.SqlClient 5.1](5.1)
- [Microsoft.Data.SqlClient 5.0](5.0)
- [Microsoft.Data.SqlClient 4.1](4.1)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# editorconfig.org

# top-most EditorConfig file
root = false

[*.cs]

# CA1310: Specify StringComparison for correctness
dotnet_diagnostic.CA1310.severity = error
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// NOTE: The current Microsoft.VSDesigner editor attributes are implemented for System.Data.SqlClient, and are not publicly available.
// New attributes that are designed to work with Microsoft.Data.SqlClient and are publicly documented should be included in future.

[assembly: System.CLSCompliant(true)]
namespace Microsoft.Data
{
Expand Down Expand Up @@ -839,6 +840,8 @@ public void RegisterColumnEncryptionKeyStoreProvidersOnConnection(System.Collect
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml' path='docs/members[@name="SqlConnection"]/ClientConnectionId/*'/>
[System.ComponentModel.DesignerSerializationVisibilityAttribute(0)]
public System.Guid ClientConnectionId { get { throw null; } }
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml' path='docs/members[@name="SqlConnection"]/AccessTokenCallback/*' />
public System.Func<SqlAuthenticationParameters, System.Threading.CancellationToken, System.Threading.Tasks.Task<SqlAuthenticationToken>> AccessTokenCallback { get { throw null; } set { } }

///
/// for internal test only
Expand Down
3 changes: 3 additions & 0 deletions src/Microsoft.Data.SqlClient/netcore/src/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ csharp_prefer_simple_using_statement = false

# SYSLIB0039: Type or member is obsolete
dotnet_diagnostic.SYSLIB0039.severity = suggestion

# CA1310: Specify StringComparison for correctness
dotnet_diagnostic.CA1310.severity = error
25 changes: 0 additions & 25 deletions src/Microsoft.Data.SqlClient/netcore/src/Common/Common.Tests.sln

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7e3a257

Please sign in to comment.