Skip to content

Commit

Permalink
nullable return type updates
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSmoke committed Oct 3, 2023
1 parent 15747b5 commit 81c3e98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/Repositories/MsSql/src/BaseMsSqlRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected async Task<int> ExecuteAsync(string sql, object? param = null)
/// <param name="sql"></param>
/// <param name="param"></param>
/// <returns></returns>
protected async Task<T> ExecuteScalarAsync<T>(string sql, object? param = null)
protected async Task<T?> ExecuteScalarAsync<T>(string sql, object? param = null)
{
using var conn = GetWriteConnection();
return await conn.ExecuteScalarAsync<T>(sql, param);
Expand All @@ -44,7 +44,7 @@ protected async Task<T> ExecuteScalarAsync<T>(string sql, object? param = null)
/// <param name="sql"></param>
/// <param name="param"></param>
/// <returns></returns>
protected async Task<T> QueryScalarValueAsync<T>(string sql, object? param = null)
protected async Task<T?> QueryScalarValueAsync<T>(string sql, object? param = null)
{
using var conn = GetReadConnection();
return await conn.ExecuteScalarAsync<T>(sql, param);
Expand All @@ -57,7 +57,7 @@ protected async Task<T> QueryScalarValueAsync<T>(string sql, object? param = nul
/// <param name="sql"></param>
/// <param name="param"></param>
/// <returns></returns>
protected async Task<T> QueryFirstAsync<T>(string sql, object? param = null)
protected async Task<T?> QueryFirstAsync<T>(string sql, object? param = null)
{
using var conn = GetReadConnection();
return await conn.QueryFirstOrDefaultAsync<T>(sql, param);
Expand All @@ -70,7 +70,7 @@ protected async Task<T> QueryFirstAsync<T>(string sql, object? param = null)
/// <param name="sql"></param>
/// <param name="param"></param>
/// <returns></returns>
protected async Task<T> QuerySingleAsync<T>(string sql, object? param = null)
protected async Task<T?> QuerySingleAsync<T>(string sql, object? param = null)
{
using var conn = GetReadConnection();
return await conn.QuerySingleOrDefaultAsync<T>(sql, param);
Expand Down
8 changes: 4 additions & 4 deletions src/Repositories/MySql/src/BaseMySqlRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected Task<int> ExecuteAsync(string sql, object? param = null, CancellationT
/// <param name="param"></param>
/// <param name="token"></param>
/// <returns></returns>
protected Task<T> ExecuteScalarAsync<T>(string sql, object? param = null, CancellationToken token = default)
protected Task<T?> ExecuteScalarAsync<T>(string sql, object? param = null, CancellationToken token = default)
{
return WrapAsync((con, cd) => con.ExecuteScalarAsync<T>(cd),
write: true,
Expand All @@ -95,7 +95,7 @@ protected Task<T> ExecuteScalarAsync<T>(string sql, object? param = null, Cancel
/// <param name="param"></param>
/// <param name="token"></param>
/// <returns></returns>
protected Task<T> QueryScalarValueAsync<T>(string sql, object? param = null, CancellationToken token = default)
protected Task<T?> QueryScalarValueAsync<T>(string sql, object? param = null, CancellationToken token = default)
{
return WrapAsync((con, cd) => con.ExecuteScalarAsync<T>(cd),
write: false,
Expand All @@ -112,7 +112,7 @@ protected Task<T> QueryScalarValueAsync<T>(string sql, object? param = null, Can
/// <param name="param"></param>
/// <param name="token"></param>
/// <returns></returns>
protected Task<T> QueryFirstAsync<T>(string sql, object? param = null, CancellationToken token = default)
protected Task<T?> QueryFirstAsync<T>(string sql, object? param = null, CancellationToken token = default)
{
return WrapAsync((con, cd) => con.QueryFirstOrDefaultAsync<T>(cd),
write: false,
Expand All @@ -129,7 +129,7 @@ protected Task<T> QueryFirstAsync<T>(string sql, object? param = null, Cancellat
/// <param name="param"></param>
/// <param name="token"></param>
/// <returns></returns>
protected Task<T> QuerySingleAsync<T>(string sql, object? param = null, CancellationToken token = default)
protected Task<T?> QuerySingleAsync<T>(string sql, object? param = null, CancellationToken token = default)
{
return WrapAsync((con, cd) => con.QuerySingleOrDefaultAsync<T>(cd),
write: false,
Expand Down

0 comments on commit 81c3e98

Please sign in to comment.