-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #1715 adds net6 TFM
- Loading branch information
Showing
6 changed files
with
109 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#nullable enable | ||
Dapper.SqlMapper.GridReader.DisposeAsync() -> System.Threading.Tasks.ValueTask | ||
Dapper.SqlMapper.GridReader.ReadUnbufferedAsync() -> System.Collections.Generic.IAsyncEnumerable<dynamic!>! | ||
Dapper.SqlMapper.GridReader.ReadUnbufferedAsync<T>() -> System.Collections.Generic.IAsyncEnumerable<T>! | ||
static Dapper.SqlMapper.QueryUnbufferedAsync(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IAsyncEnumerable<dynamic!>! | ||
static Dapper.SqlMapper.QueryUnbufferedAsync<T>(this System.Data.Common.DbConnection! cnn, string! sql, object? param = null, System.Data.Common.DbTransaction? transaction = null, int? commandTimeout = null, System.Data.CommandType? commandType = null) -> System.Collections.Generic.IAsyncEnumerable<T>! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#nullable enable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
#if NET6_0_OR_GREATER | ||
namespace Dapper.Tests; | ||
|
||
/* we do **NOT** expect this to work against System.Data | ||
[Collection("DateTimeOnlyTests")] | ||
public sealed class SystemSqlClientDateTimeOnlyTests : DateTimeOnlyTests<SystemSqlClientProvider> { } | ||
*/ | ||
#if MSSQLCLIENT | ||
[Collection("DateTimeOnlyTests")] | ||
public sealed class MicrosoftSqlClientDateTimeOnlyTests : DateTimeOnlyTests<MicrosoftSqlClientProvider> { } | ||
#endif | ||
public abstract class DateTimeOnlyTests<TProvider> : TestBase<TProvider> where TProvider : DatabaseProvider | ||
{ | ||
public class HazDateTimeOnly | ||
{ | ||
public DateOnly Date { get; set; } | ||
public TimeOnly Time { get; set; } | ||
} | ||
|
||
[Fact] | ||
public void TypedInOut() | ||
{ | ||
var now = DateTime.Now; | ||
var args = new HazDateTimeOnly | ||
{ | ||
Date = DateOnly.FromDateTime(now), | ||
Time = TimeOnly.FromDateTime(now), | ||
}; | ||
var row = connection.QuerySingle<HazDateTimeOnly>("select @date as [Date], @time as [Time]", args); | ||
Assert.Equal(args.Date, row.Date); | ||
Assert.Equal(args.Time, row.Time); | ||
} | ||
|
||
[Fact] | ||
public async Task TypedInOutAsync() | ||
{ | ||
var now = DateTime.Now; | ||
var args = new HazDateTimeOnly | ||
{ | ||
Date = DateOnly.FromDateTime(now), | ||
Time = TimeOnly.FromDateTime(now), | ||
}; | ||
var row = await connection.QuerySingleAsync<HazDateTimeOnly>("select @date as [Date], @time as [Time]", args); | ||
Assert.Equal(args.Date, row.Date); | ||
Assert.Equal(args.Time, row.Time); | ||
} | ||
|
||
[Fact] | ||
public void UntypedInOut() | ||
{ | ||
var now = DateTime.Now; | ||
var args = new DynamicParameters(); | ||
var date = DateOnly.FromDateTime(now); | ||
var time = TimeOnly.FromDateTime(now); | ||
args.Add("date", date); | ||
args.Add("time", time); | ||
var row = connection.QuerySingle<dynamic>("select @date as [Date], @time as [Time]", args); | ||
// untyped, observation is that these come back as DateTime and TimeSpan | ||
Assert.Equal(date, DateOnly.FromDateTime((DateTime)row.Date)); | ||
Assert.Equal(time, TimeOnly.FromTimeSpan((TimeSpan)row.Time)); | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters