Skip to content

Commit 49610e0

Browse files
Merge pull request #21 from Open-NET-Libraries/v8
V8 Merge
2 parents 8269297 + aab8044 commit 49610e0

File tree

66 files changed

+1527
-635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1527
-635
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,6 @@ dotnet_naming_style.begins_with_i.capitalization = pascal_case
219219

220220
# RCS1123: Add parentheses when necessary.
221221
dotnet_diagnostic.RCS1123.severity = silent
222+
223+
# Only available in .NET 8
224+
dotnet_diagnostic.CA1510.severity = silent

Open.Database.Extensions.sln

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Open.Database.Extensions.Co
1717
EndProject
1818
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{B4ADB121-1900-4CB4-905C-A7B1F640BA8A}"
1919
EndProject
20+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3194AC1F-55DE-4EAE-BDC6-4E427B034CFF}"
21+
ProjectSection(SolutionItems) = preProject
22+
.editorconfig = .editorconfig
23+
EndProjectSection
24+
EndProject
25+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Open.Database.Extensions.MSSqlClient", "Source\MSSqlClient\Open.Database.Extensions.MSSqlClient.csproj", "{B9245504-9E2F-417F-87AC-8950BFB4FD4E}"
26+
EndProject
2027
Global
2128
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2229
Debug|Any CPU = Debug|Any CPU
@@ -47,6 +54,10 @@ Global
4754
{B2C2E89F-3B08-4CF8-B363-468C0918F867}.Debug|Any CPU.Build.0 = Debug|Any CPU
4855
{B2C2E89F-3B08-4CF8-B363-468C0918F867}.Release|Any CPU.ActiveCfg = Release|Any CPU
4956
{B2C2E89F-3B08-4CF8-B363-468C0918F867}.Release|Any CPU.Build.0 = Release|Any CPU
57+
{B9245504-9E2F-417F-87AC-8950BFB4FD4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
58+
{B9245504-9E2F-417F-87AC-8950BFB4FD4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
59+
{B9245504-9E2F-417F-87AC-8950BFB4FD4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
60+
{B9245504-9E2F-417F-87AC-8950BFB4FD4E}.Release|Any CPU.Build.0 = Release|Any CPU
5061
EndGlobalSection
5162
GlobalSection(SolutionProperties) = preSolution
5263
HideSolutionNode = FALSE

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ The provided expressive command classes allow for an expressive means to append
1515

1616
Extensions are provided to create commands from connection factories.
1717

18+
## 8.0 Release Notes
19+
20+
- All `.ConfigureAwait(true)` are now `.ConfigureAwait(false)` as they should be. The caller will need to `.ConfigureAwait(true)` if they need to resume on the calling context.
21+
- Added `Open.Database.Extensions.MSSqlClient` for `Microsoft.Data.SqlClient` support.
22+
- .NET 8.0 added to targets to ensure potential compliation and performance improvements are available.
23+
- Improved nullable integrity.
24+
1825
### Example
1926

2027
```cs

Source/Channel/AsChannel.cs

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
using System;
2-
using System.Buffers;
3-
using System.Collections.Generic;
4-
using System.Data;
5-
using System.Data.Common;
6-
using System.Diagnostics.Contracts;
7-
using System.Threading;
8-
using System.Threading.Channels;
9-
10-
namespace Open.Database.Extensions;
1+
namespace Open.Database.Extensions;
112

123
[System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2012:Use ValueTasks correctly", Justification = "Intentionally running in the background.")]
134
[System.Diagnostics.CodeAnalysis.SuppressMessage("Roslynator", "RCS1047:Non-asynchronous method name should not end with 'Async'.", Justification = "<Pending>")]
@@ -42,16 +33,16 @@ public static ChannelReader<object[]> AsChannel(this IDataReader reader,
4233
/// <param name="arrayPool">The array pool to acquire buffers from.</param>
4334
/// <param name="cancellationToken">An optional cancellation token.</param>
4435
/// <returns>The channel reader containing the results.</returns>
45-
public static ChannelReader<object?[]> AsChannel(this IDataReader reader,
36+
public static ChannelReader<object[]> AsChannel(this IDataReader reader,
4637
bool singleReader,
47-
ArrayPool<object?> arrayPool,
38+
ArrayPool<object> arrayPool,
4839
CancellationToken cancellationToken = default)
4940
{
5041
if (reader is null) throw new ArgumentNullException(nameof(reader));
5142
if (arrayPool is null) throw new ArgumentNullException(nameof(arrayPool));
5243
Contract.EndContractBlock();
5344

54-
var channel = CreateChannel<object?[]>(-1, singleReader);
45+
var channel = CreateChannel<object[]>(-1, singleReader);
5546
_ = ToChannel(reader, channel.Writer, true, arrayPool, cancellationToken);
5647
return channel.Reader;
5748
}
@@ -153,16 +144,16 @@ public static ChannelReader<object[]> AsChannel(this IDbCommand command,
153144
/// <param name="arrayPool">The array pool to acquire buffers from.</param>
154145
/// <param name="cancellationToken">An optional cancellation token.</param>
155146
/// <returns>The channel reader containing the results.</returns>
156-
public static ChannelReader<object?[]> AsChannel(this IDbCommand command,
147+
public static ChannelReader<object[]> AsChannel(this IDbCommand command,
157148
bool singleReader,
158-
ArrayPool<object?> arrayPool,
149+
ArrayPool<object> arrayPool,
159150
CancellationToken cancellationToken = default)
160151
{
161152
if (command is null) throw new ArgumentNullException(nameof(command));
162153
if (arrayPool is null) throw new ArgumentNullException(nameof(arrayPool));
163154
Contract.EndContractBlock();
164155

165-
var channel = CreateChannel<object?[]>(-1, singleReader);
156+
var channel = CreateChannel<object[]>(-1, singleReader);
166157
_ = ToChannel(command, channel.Writer, true, arrayPool, cancellationToken);
167158
return channel.Reader;
168159
}
@@ -261,15 +252,15 @@ public static ChannelReader<object[]> AsChannel(this IExecuteReader command,
261252
/// <param name="singleReader">True will cause the resultant reader to optimize for the assumption that no concurrent read operations will occur.</param>
262253
/// <param name="arrayPool">The array pool to acquire buffers from.</param>
263254
/// <returns>The channel reader containing the results.</returns>
264-
public static ChannelReader<object?[]> AsChannel(this IExecuteReader command,
255+
public static ChannelReader<object[]> AsChannel(this IExecuteReader command,
265256
bool singleReader,
266-
ArrayPool<object?> arrayPool)
257+
ArrayPool<object> arrayPool)
267258
{
268259
if (command is null) throw new ArgumentNullException(nameof(command));
269260
if (arrayPool is null) throw new ArgumentNullException(nameof(arrayPool));
270261
Contract.EndContractBlock();
271262

272-
var channel = CreateChannel<object?[]>(-1, singleReader);
263+
var channel = CreateChannel<object[]>(-1, singleReader);
273264
_ = ToChannel(command, channel.Writer, true, arrayPool);
274265
return channel.Reader;
275266
}
@@ -336,7 +327,8 @@ public static ChannelReader<T> AsChannel<T>(this IExecuteReader command,
336327
return channel.Reader;
337328
}
338329

339-
#if NETSTANDARD2_1
330+
#if NETSTANDARD2_0
331+
#else
340332
/// <summary>
341333
/// Asynchronously iterates an DbDataReader and writes each record as an array to an unbound channel.
342334
/// Iterates an DbDataReader through the transform function and writes each record to an unbound channel.
@@ -367,16 +359,16 @@ public static ChannelReader<object[]> AsChannelAsync(this DbDataReader reader,
367359
/// <param name="arrayPool">The array pool to acquire buffers from.</param>
368360
/// <param name="cancellationToken">An optional cancellation token.</param>
369361
/// <returns>The channel reader containing the results.</returns>
370-
public static ChannelReader<object?[]> AsChannelAsync(this DbDataReader reader,
362+
public static ChannelReader<object[]> AsChannelAsync(this DbDataReader reader,
371363
bool singleReader,
372-
ArrayPool<object?> arrayPool,
364+
ArrayPool<object> arrayPool,
373365
CancellationToken cancellationToken = default)
374366
{
375367
if (reader is null) throw new ArgumentNullException(nameof(reader));
376368
if (arrayPool is null) throw new ArgumentNullException(nameof(arrayPool));
377369
Contract.EndContractBlock();
378370

379-
var channel = CreateChannel<object?[]>(-1, singleReader);
371+
var channel = CreateChannel<object[]>(-1, singleReader);
380372
_ = ToChannelAsync(reader, channel.Writer, true, arrayPool, cancellationToken);
381373
return channel.Reader;
382374
}
@@ -478,16 +470,16 @@ public static ChannelReader<object[]> AsChannelAsync(this DbCommand command,
478470
/// <param name="arrayPool">The array pool to acquire buffers from.</param>
479471
/// <param name="cancellationToken">An optional cancellation token.</param>
480472
/// <returns>The channel reader containing the results.</returns>
481-
public static ChannelReader<object?[]> AsChannelAsync(this DbCommand command,
473+
public static ChannelReader<object[]> AsChannelAsync(this DbCommand command,
482474
bool singleReader,
483-
ArrayPool<object?> arrayPool,
475+
ArrayPool<object> arrayPool,
484476
CancellationToken cancellationToken = default)
485477
{
486478
if (command is null) throw new ArgumentNullException(nameof(command));
487479
if (arrayPool is null) throw new ArgumentNullException(nameof(arrayPool));
488480
Contract.EndContractBlock();
489481

490-
var channel = CreateChannel<object?[]>(-1, singleReader);
482+
var channel = CreateChannel<object[]>(-1, singleReader);
491483
_ = ToChannelAsync(command, channel.Writer, true, arrayPool, cancellationToken);
492484
return channel.Reader;
493485
}
@@ -586,14 +578,14 @@ public static ChannelReader<object[]> AsChannelAsync(this IExecuteReaderAsync co
586578
/// <param name="singleReader">True will cause the resultant reader to optimize for the assumption that no concurrent read operations will occur.</param>
587579
/// <param name="arrayPool">The array pool to acquire buffers from.</param>
588580
/// <returns>The channel reader containing the results.</returns>
589-
public static ChannelReader<object?[]> AsChannelAsync(this IExecuteReaderAsync command,
581+
public static ChannelReader<object[]> AsChannelAsync(this IExecuteReaderAsync command,
590582
bool singleReader,
591-
ArrayPool<object?> arrayPool)
583+
ArrayPool<object> arrayPool)
592584
{
593585
if (command is null) throw new ArgumentNullException(nameof(command));
594586
Contract.EndContractBlock();
595587

596-
var channel = CreateChannel<object?[]>(-1, singleReader);
588+
var channel = CreateChannel<object[]>(-1, singleReader);
597589
_ = ToChannelAsync(command, channel.Writer, true, arrayPool);
598590
return channel.Reader;
599591
}

Source/Channel/CreateChannel.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using System;
2-
using System.Diagnostics.Contracts;
3-
using System.Threading.Channels;
4-
5-
namespace Open.Database.Extensions;
1+
namespace Open.Database.Extensions;
62

73
public static partial class ChannelDbExtensions
84
{

Source/Channel/GlobalUsings.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
global using Open.ChannelExtensions;
2+
global using System;
3+
global using System.Buffers;
4+
global using System.Collections.Generic;
5+
global using System.Collections.Immutable;
6+
global using System.Data;
7+
global using System.Data.Common;
8+
global using System.Diagnostics.Contracts;
9+
global using System.Linq;
10+
global using System.Threading;
11+
global using System.Threading.Channels;
12+
global using System.Threading.Tasks;

Source/Channel/Open.Database.Extensions.Channel.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<RootNamespace>Open.Database.Extensions</RootNamespace>
5-
<TargetFrameworks>netstandard2.0; netstandard2.1</TargetFrameworks>
5+
<TargetFrameworks>netstandard2.0; netstandard2.1; net8.0</TargetFrameworks>
66
<LangVersion>latest</LangVersion>
77
<Nullable>enable</Nullable>
88
<Authors>electricessence</Authors>
@@ -14,7 +14,7 @@
1414
<PackageTags>ado;ado extensions;sql;connection factory;extensions;channel;channels</PackageTags>
1515
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1616
<RepositoryType>git</RepositoryType>
17-
<Version>7.2.0</Version>
17+
<Version>8.0.0</Version>
1818
<PackageReleaseNotes></PackageReleaseNotes>
1919
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2020
<IncludeSymbols>true</IncludeSymbols>
@@ -27,7 +27,7 @@
2727
</PropertyGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
30+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
3131
<PackageReference Include="Open.ChannelExtensions" Version="6.2.2" />
3232
</ItemGroup>
3333

0 commit comments

Comments
 (0)