Skip to content

Commit

Permalink
Fixed NRT warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdanyliv committed Mar 25, 2021
1 parent 3272e4d commit ebd615c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
16 changes: 12 additions & 4 deletions Source/LinqToDB.EntityFrameworkCore/LinqToDBExtensionsAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,21 @@ public Task<TSource> FirstAsync<TSource>(
=> EntityFrameworkQueryableExtensions.FirstAsync(source, predicate, token);

/// <inheritdoc cref="EntityFrameworkQueryableExtensions.FirstOrDefaultAsync{TSource}(IQueryable{TSource}, CancellationToken)"/>
public Task<TSource> FirstOrDefaultAsync<TSource>(
public Task<TSource?> FirstOrDefaultAsync<TSource>(
IQueryable<TSource> source,
CancellationToken token)
#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type.
=> EntityFrameworkQueryableExtensions.FirstOrDefaultAsync(source, token);
#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type.

/// <inheritdoc cref="EntityFrameworkQueryableExtensions.FirstOrDefaultAsync{TSource}(IQueryable{TSource}, Expression{Func{TSource, bool}}, CancellationToken)"/>
public Task<TSource> FirstOrDefaultAsync<TSource>(
public Task<TSource?> FirstOrDefaultAsync<TSource>(
IQueryable<TSource> source,
Expression<Func<TSource,bool>> predicate,
CancellationToken token)
#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type.
=> EntityFrameworkQueryableExtensions.FirstOrDefaultAsync(source, predicate, token);
#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type.

/// <inheritdoc cref="EntityFrameworkQueryableExtensions.SingleAsync{TSource}(IQueryable{TSource}, CancellationToken)"/>
public Task<TSource> SingleAsync<TSource>(
Expand All @@ -113,17 +117,21 @@ public Task<TSource> SingleAsync<TSource>(
=> EntityFrameworkQueryableExtensions.SingleAsync(source, predicate, token);

/// <inheritdoc cref="EntityFrameworkQueryableExtensions.SingleOrDefaultAsync{TSource}(IQueryable{TSource}, CancellationToken)"/>
public Task<TSource> SingleOrDefaultAsync<TSource>(
public Task<TSource?> SingleOrDefaultAsync<TSource>(
IQueryable<TSource> source,
CancellationToken token)
#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type.
=> EntityFrameworkQueryableExtensions.SingleOrDefaultAsync(source, token);
#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type.

/// <inheritdoc cref="EntityFrameworkQueryableExtensions.SingleOrDefaultAsync{TSource}(IQueryable{TSource}, Expression{Func{TSource, bool}}, CancellationToken)"/>
public Task<TSource> SingleOrDefaultAsync<TSource>(
public Task<TSource?> SingleOrDefaultAsync<TSource>(
IQueryable<TSource> source,
Expression<Func<TSource,bool>> predicate,
CancellationToken token)
#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type.
=> EntityFrameworkQueryableExtensions.SingleOrDefaultAsync(source, predicate, token);
#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type.

/// <inheritdoc cref="EntityFrameworkQueryableExtensions.ContainsAsync{TSource}(IQueryable{TSource}, TSource, CancellationToken)"/>
public Task<bool> ContainsAsync<TSource>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ public static Task<TSource> FirstAsyncLinqToDB<TSource>(
=> AsyncExtensions.FirstAsync(source.ToLinqToDB(), predicate, token);

/// <inheritdoc cref="AsyncExtensions.FirstOrDefaultAsync{TSource}(IQueryable{TSource}, CancellationToken)"/>
public static Task<TSource> FirstOrDefaultAsyncLinqToDB<TSource>(
public static Task<TSource?> FirstOrDefaultAsyncLinqToDB<TSource>(
this IQueryable<TSource> source,
CancellationToken token = default)
=> AsyncExtensions.FirstOrDefaultAsync(source.ToLinqToDB(), token);

/// <inheritdoc cref="AsyncExtensions.FirstOrDefaultAsync{TSource}(IQueryable{TSource}, Expression{Func{TSource, bool}}, CancellationToken)"/>
public static Task<TSource> FirstOrDefaultAsyncLinqToDB<TSource>(
public static Task<TSource?> FirstOrDefaultAsyncLinqToDB<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource,bool>> predicate,
CancellationToken token = default)
Expand All @@ -102,13 +102,13 @@ public static Task<TSource> SingleAsyncLinqToDB<TSource>(
=> AsyncExtensions.SingleAsync(source.ToLinqToDB(), predicate, token);

/// <inheritdoc cref="AsyncExtensions.SingleOrDefaultAsync{TSource}(IQueryable{TSource}, CancellationToken)"/>
public static Task<TSource> SingleOrDefaultAsyncLinqToDB<TSource>(
public static Task<TSource?> SingleOrDefaultAsyncLinqToDB<TSource>(
this IQueryable<TSource> source,
CancellationToken token = default)
=> AsyncExtensions.SingleOrDefaultAsync(source.ToLinqToDB(), token);

/// <inheritdoc cref="AsyncExtensions.SingleOrDefaultAsync{TSource}(IQueryable{TSource}, Expression{Func{TSource, bool}}, CancellationToken)"/>
public static Task<TSource> SingleOrDefaultAsyncLinqToDB<TSource>(
public static Task<TSource?> SingleOrDefaultAsyncLinqToDB<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource,bool>> predicate,
CancellationToken token = default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ public static async Task<BulkCopyRowsCopied> BulkCopyAsync<T>(
[LinqTunnel]
[Pure]
public static IValueInsertable<T> Into<T>(this DbContext context, ITable<T> target)
where T: notnull
{
if (context == null) throw new ArgumentNullException(nameof(context));
if (target == null) throw new ArgumentNullException(nameof(target));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ protected virtual IDataProvider CreateSqlServerProvider(SqlServerVersion version
{
providerName = "Microsoft.Data.SqlClient";

return DataConnection.GetDataProvider(providerName, connectionString)!;
return DataConnection.GetDataProvider(providerName, connectionString!)!;
}

switch (version)
Expand Down Expand Up @@ -364,7 +364,7 @@ protected virtual IDataProvider CreateSqlServerProvider(SqlServerVersion version
protected virtual IDataProvider CreatePostgreSqlProvider(PostgreSQLVersion version, string? connectionString)
{
if (!string.IsNullOrEmpty(connectionString))
return DataConnection.GetDataProvider(ProviderName.PostgreSQL, connectionString)!;
return DataConnection.GetDataProvider(ProviderName.PostgreSQL, connectionString!)!;

string providerName;
switch (version)
Expand Down

0 comments on commit ebd615c

Please sign in to comment.