Skip to content

Commit

Permalink
Annotate query with nullable reference types (dotnet#23126)
Browse files Browse the repository at this point in the history
  • Loading branch information
smitpatel committed Oct 30, 2020
1 parent 7c5c1fc commit 4699660
Show file tree
Hide file tree
Showing 97 changed files with 422 additions and 223 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,8 @@ protected override ShapedQueryExpression TranslateJoin(
{
Check.NotNull(outer, nameof(outer));
Check.NotNull(inner, nameof(inner));
Check.NotNull(outerKeySelector, nameof(outerKeySelector));
Check.NotNull(innerKeySelector, nameof(innerKeySelector));
Check.NotNull(resultSelector, nameof(resultSelector));

return null;
Expand Down Expand Up @@ -618,6 +620,8 @@ protected override ShapedQueryExpression TranslateLeftJoin(
{
Check.NotNull(outer, nameof(outer));
Check.NotNull(inner, nameof(inner));
Check.NotNull(outerKeySelector, nameof(outerKeySelector));
Check.NotNull(innerKeySelector, nameof(innerKeySelector));
Check.NotNull(resultSelector, nameof(resultSelector));

return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Diagnostics.CodeAnalysis;
using System.Linq.Expressions;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Query;

namespace Microsoft.EntityFrameworkCore.Cosmos.Query.Internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public override Expression Visit(Expression expression)
_queryableMethodTranslatingExpressionVisitor.TranslateSubquery(
materializeCollectionNavigationExpression.Subquery),
materializeCollectionNavigationExpression.Navigation,
null);
materializeCollectionNavigationExpression.Navigation.ClrType.TryGetSequenceType());

case MethodCallExpression methodCallExpression:
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,8 @@ protected override ShapedQueryExpression TranslateJoin(
{
Check.NotNull(outer, nameof(outer));
Check.NotNull(inner, nameof(inner));
Check.NotNull(outerKeySelector, nameof(outerKeySelector));
Check.NotNull(innerKeySelector, nameof(innerKeySelector));
Check.NotNull(resultSelector, nameof(resultSelector));

(outerKeySelector, innerKeySelector) = ProcessJoinKeySelector(outer, inner, outerKeySelector, innerKeySelector);
Expand Down Expand Up @@ -726,6 +728,8 @@ protected override ShapedQueryExpression TranslateLeftJoin(
{
Check.NotNull(outer, nameof(outer));
Check.NotNull(inner, nameof(inner));
Check.NotNull(outerKeySelector, nameof(outerKeySelector));
Check.NotNull(innerKeySelector, nameof(innerKeySelector));
Check.NotNull(resultSelector, nameof(resultSelector));

(outerKeySelector, innerKeySelector) = ProcessJoinKeySelector(outer, inner, outerKeySelector, innerKeySelector);
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.InMemory/Storage/InMemoryDatabaseRoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.EntityFrameworkCore.Storage
/// across context instances and service providers as long as the same instance
/// of this type is passed to
/// <see
/// cref="InMemoryDbContextOptionsExtensions.UseInMemoryDatabase{TContext}(DbContextOptionsBuilder{TContext},string,System.Action{Infrastructure.InMemoryDbContextOptionsBuilder})" />
/// cref="InMemoryDbContextOptionsExtensions.UseInMemoryDatabase{TContext}(DbContextOptionsBuilder{TContext},string,System.Action{InMemoryDbContextOptionsBuilder})" />
/// </summary>
public sealed class InMemoryDatabaseRoot
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ public static void SetCommandTimeout([NotNull] this DatabaseFacade databaseFacad
/// </para>
/// <para>
/// This is a sugar method allowing a <see cref="TimeSpan" /> to be used to set the value. It delegates to
/// <see cref="SetCommandTimeout(DatabaseFacade,Nullable{int})" />.
/// <see cref="SetCommandTimeout(DatabaseFacade,int?)" />.
/// </para>
/// </summary>
/// <param name="databaseFacade"> The <see cref="DatabaseFacade" /> for the context. </param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ public override Expression Visit(Expression expression)
return _selectExpression.AddCollectionProjection(
_queryableMethodTranslatingExpressionVisitor.TranslateSubquery(
materializeCollectionNavigationExpression.Subquery),
materializeCollectionNavigationExpression.Navigation, null);
materializeCollectionNavigationExpression.Navigation,
materializeCollectionNavigationExpression.Navigation.ClrType.TryGetSequenceType());

case MethodCallExpression methodCallExpression:
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@ protected override ShapedQueryExpression TranslateJoin(
{
Check.NotNull(outer, nameof(outer));
Check.NotNull(inner, nameof(inner));
Check.NotNull(outerKeySelector, nameof(outerKeySelector));
Check.NotNull(innerKeySelector, nameof(innerKeySelector));
Check.NotNull(resultSelector, nameof(resultSelector));

var joinPredicate = CreateJoinPredicate(outer, outerKeySelector, inner, innerKeySelector);
Expand All @@ -611,6 +613,8 @@ protected override ShapedQueryExpression TranslateLeftJoin(
{
Check.NotNull(outer, nameof(outer));
Check.NotNull(inner, nameof(inner));
Check.NotNull(outerKeySelector, nameof(outerKeySelector));
Check.NotNull(innerKeySelector, nameof(innerKeySelector));
Check.NotNull(resultSelector, nameof(resultSelector));

var joinPredicate = CreateJoinPredicate(outer, outerKeySelector, inner, innerKeySelector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ static Expression RemoveConvert(Expression expression)
public CollectionShaperExpression AddCollectionProjection(
[NotNull] ShapedQueryExpression shapedQueryExpression,
[CanBeNull] INavigationBase navigation,
[CanBeNull] Type elementType)
[NotNull] Type elementType)
{
Check.NotNull(shapedQueryExpression, nameof(shapedQueryExpression));

Expand Down
12 changes: 6 additions & 6 deletions src/EFCore.Relational/Storage/RelationalConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public virtual void EnlistTransaction(Transaction transaction)
}

/// <summary>
/// Template method that by default calls <see cref="System.Data.Common.DbConnection.EnlistTransaction" /> but can be overriden
/// Template method that by default calls <see cref="DbConnection.EnlistTransaction" /> but can be overriden
/// by providers to make a different call instead.
/// </summary>
/// <param name="transaction"> The transaction to be used. </param>
Expand Down Expand Up @@ -322,7 +322,7 @@ public virtual IDbContextTransaction BeginTransaction(IsolationLevel isolationLe
}

/// <summary>
/// Template method that by default calls <see cref="System.Data.Common.DbConnection.BeginDbTransaction" /> but can be overriden
/// Template method that by default calls <see cref="DbConnection.BeginDbTransaction" /> but can be overriden
/// by providers to make a different call instead.
/// </summary>
/// <param name="isolationLevel"> The isolation level to use for the transaction. </param>
Expand Down Expand Up @@ -376,7 +376,7 @@ public virtual async Task<IDbContextTransaction> BeginTransactionAsync(
}

/// <summary>
/// Template method that by default calls <see cref="System.Data.Common.DbConnection.BeginDbTransactionAsync" /> but can be overriden
/// Template method that by default calls <see cref="DbConnection.BeginDbTransactionAsync" /> but can be overriden
/// by providers to make a different call instead.
/// </summary>
/// <param name="isolationLevel"> The isolation level to use for the transaction. </param>
Expand Down Expand Up @@ -682,7 +682,7 @@ private void OpenInternal(bool errorsExpected)
}

/// <summary>
/// Template method that by default calls <see cref="System.Data.Common.DbConnection.Open" /> but can be overriden
/// Template method that by default calls <see cref="DbConnection.Open" /> but can be overriden
/// by providers to make a different call instead.
/// </summary>
/// <param name="errorsExpected"> Indicates if the connection errors are expected and should be logged as debug message. </param>
Expand Down Expand Up @@ -836,7 +836,7 @@ public virtual bool Close()
}

/// <summary>
/// Template method that by default calls <see cref="System.Data.Common.DbConnection.Close" /> but can be overriden
/// Template method that by default calls <see cref="DbConnection.Close" /> but can be overriden
/// by providers to make a different call instead.
/// </summary>
protected virtual void CloseDbConnection()
Expand Down Expand Up @@ -988,7 +988,7 @@ public virtual async ValueTask DisposeAsync()
}

/// <summary>
/// Template method that by default calls <see cref="System.Data.Common.DbConnection.DisposeAsync" /> but can be overriden
/// Template method that by default calls <see cref="DbConnection.DisposeAsync" /> but can be overriden
/// by providers to make a different call instead.
/// </summary>
protected virtual ValueTask DisposeDbConnectionAsync()
Expand Down
4 changes: 2 additions & 2 deletions src/EFCore.Relational/Storage/RelationalDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public virtual DbCommand DbCommand
=> _command;

/// <summary>
/// Calls <see cref="System.Data.Common.DbDataReader.Read()" /> on the underlying <see cref="System.Data.Common.DbDataReader" />.
/// Calls <see cref="DbDataReader.Read()" /> on the underlying <see cref="System.Data.Common.DbDataReader" />.
/// </summary>
/// <returns> <see langword="true" /> if there are more rows; otherwise <see langword="false" />. </returns>
public virtual bool Read()
Expand All @@ -87,7 +87,7 @@ public virtual bool Read()
}

/// <summary>
/// Calls <see cref="System.Data.Common.DbDataReader.ReadAsync(CancellationToken)" /> on the underlying
/// Calls <see cref="DbDataReader.ReadAsync(CancellationToken)" /> on the underlying
/// <see cref="System.Data.Common.DbDataReader" />.
/// </summary>
/// <returns> <see langword="true" /> if there are more rows; otherwise <see langword="false" />. </returns>
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Relational/Storage/StringTypeMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class StringTypeMapping : RelationalTypeMapping
/// Initializes a new instance of the <see cref="StringTypeMapping" /> class.
/// </summary>
/// <param name="storeType"> The name of the database type. </param>
/// <param name="dbType"> The <see cref="System.Data.DbType" /> to be used. </param>
/// <param name="dbType"> The <see cref="DbType" /> to be used. </param>
/// <param name="unicode"> A value indicating whether the type should handle Unicode data or not. </param>
/// <param name="size"> The size of data the property is configured to store, or null if no size is configured. </param>
public StringTypeMapping(
Expand Down
6 changes: 3 additions & 3 deletions src/EFCore.Relational/Update/ModificationCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ public virtual IReadOnlyList<IUpdateEntry> Entries

/// <summary>
/// The <see cref="EntityFrameworkCore.EntityState" /> that indicates whether the row will be
/// inserted (<see cref="EntityFrameworkCore.EntityState.Added" />),
/// updated (<see cref="EntityFrameworkCore.EntityState.Modified" />),
/// or deleted ((<see cref="EntityFrameworkCore.EntityState.Deleted" />).
/// inserted (<see cref="EntityState.Added" />),
/// updated (<see cref="EntityState.Modified" />),
/// or deleted ((<see cref="EntityState.Deleted" />).
/// </summary>
public virtual EntityState EntityState
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static class SqlDataReaderExtension
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[return: CA.MaybeNullAttribute]
[return: CA.MaybeNull]
public static T GetValueOrDefault<T>([NotNull] this DbDataReader reader, [NotNull] string name)
{
var idx = reader.GetOrdinal(name);
Expand All @@ -36,7 +36,7 @@ public static T GetValueOrDefault<T>([NotNull] this DbDataReader reader, [NotNul
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[return: CA.MaybeNullAttribute]
[return: CA.MaybeNull]
public static T GetValueOrDefault<T>([NotNull] this DbDataRecord record, [NotNull] string name)
{
var idx = record.GetOrdinal(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class SqliteStringTypeMapping : StringTypeMapping
/// Initializes a new instance of the <see cref="SqliteStringTypeMapping" /> class.
/// </summary>
/// <param name="storeType"> The name of the database type. </param>
/// <param name="dbType"> The <see cref="System.Data.DbType" /> to be used. </param>
/// <param name="dbType"> The <see cref="DbType" /> to be used. </param>
/// <param name="unicode"> A value indicating whether the type should handle Unicode data or not. </param>
/// <param name="size"> The size of data the property is configured to store, or null if no size is configured. </param>
public SqliteStringTypeMapping(
Expand Down
4 changes: 2 additions & 2 deletions src/EFCore/ChangeTracking/ChangeTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public ChangeTracker(
/// and <see cref="EntityFrameworkQueryableExtensions.AsTracking{TEntity}(IQueryable{TEntity})" /> methods.
/// </para>
/// <para>
/// The default value is <see cref="EntityFrameworkCore.QueryTrackingBehavior.TrackAll" />. This means the change tracker will
/// The default value is <see cref="QueryTrackingBehavior.TrackAll" />. This means the change tracker will
/// keep track of changes for all entities that are returned from a LINQ query.
/// </para>
/// </summary>
Expand Down Expand Up @@ -203,7 +203,7 @@ private void TryDetectChanges()
/// <para>
/// Checks if any new, deleted, or changed entities are being tracked
/// such that these changes will be sent to the database if <see cref="DbContext.SaveChanges()" />
/// or <see cref="DbContext.SaveChangesAsync(System.Threading.CancellationToken)" /> is called.
/// or <see cref="DbContext.SaveChangesAsync(CancellationToken)" /> is called.
/// </para>
/// <para>
/// Note that this method calls <see cref="DetectChanges" /> unless
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore/ChangeTracking/NavigationEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private static INavigationBase GetNavigation(InternalEntityEntry internalEntry,
/// Loading entities from the database using
/// <see cref="EntityFrameworkQueryableExtensions.Include{TEntity,TProperty}" /> or
/// <see
/// cref="EntityFrameworkQueryableExtensions.ThenInclude{TEntity,TPreviousProperty,TProperty}(EntityFrameworkCore.Query.IIncludableQueryable{TEntity,IEnumerable{TPreviousProperty}},System.Linq.Expressions.Expression{System.Func{TPreviousProperty,TProperty}})" />
/// cref="EntityFrameworkQueryableExtensions.ThenInclude{TEntity,TPreviousProperty,TProperty}(Query.IIncludableQueryable{TEntity,IEnumerable{TPreviousProperty}},System.Linq.Expressions.Expression{Func{TPreviousProperty,TProperty}})" />
/// , <see cref="Load" />, or <see cref="LoadAsync" /> will set this flag. Subsequent calls to <see cref="Load" />
/// or <see cref="LoadAsync" /> will then be a no-op.
/// </para>
Expand Down
Loading

0 comments on commit 4699660

Please sign in to comment.