Skip to content

Commit

Permalink
Remove incomplete nullable reference annotations for 5.0
Browse files Browse the repository at this point in the history
Closes #21379
  • Loading branch information
roji committed Jul 20, 2020
1 parent 644d3c8 commit 901c042
Show file tree
Hide file tree
Showing 50 changed files with 80 additions and 180 deletions.
2 changes: 0 additions & 2 deletions src/EFCore.Design/Scaffolding/IModelCodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Metadata;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding
{
/// <summary>
Expand Down
4 changes: 1 addition & 3 deletions src/EFCore.Design/Scaffolding/IModelCodeGeneratorSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

using JetBrains.Annotations;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding
{
/// <summary>
Expand All @@ -17,6 +15,6 @@ public interface IModelCodeGeneratorSelector
/// </summary>
/// <param name="language"> The programming language. </param>
/// <returns> The <see cref="IModelCodeGenerator" />. </returns>
IModelCodeGenerator Select([CanBeNull] string? language);
IModelCodeGenerator Select([CanBeNull] string language);
}
}
2 changes: 0 additions & 2 deletions src/EFCore.Design/Scaffolding/IReverseEngineerScaffolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

using JetBrains.Annotations;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Utilities;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand Down Expand Up @@ -65,7 +63,7 @@ public virtual string WriteCode(
IModel model,
string contextName,
string connectionString,
string? contextNamespace,
string contextNamespace,
string modelNamespace,
bool useDataAnnotations,
bool suppressConnectionStringWarning,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Utilities;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Utilities;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand Down
6 changes: 2 additions & 4 deletions src/EFCore.Design/Scaffolding/Internal/CSharpNamer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Utilities;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand All @@ -20,7 +18,7 @@ public class CSharpNamer<T>
{
private readonly Func<T, string> _nameGetter;
private readonly ICSharpUtilities _cSharpUtilities;
private readonly Func<string, string>? _singularizePluralizer;
private readonly Func<string, string> _singularizePluralizer;

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Expand All @@ -39,7 +37,7 @@ public class CSharpNamer<T>
public CSharpNamer(
[NotNull] Func<T, string> nameGetter,
[NotNull] ICSharpUtilities cSharpUtilities,
[CanBeNull] Func<string, string>? singularizePluralizer)
[CanBeNull] Func<string, string> singularizePluralizer)
{
Check.NotNull(nameGetter, nameof(nameGetter));
Check.NotNull(cSharpUtilities, nameof(cSharpUtilities));
Expand Down
8 changes: 3 additions & 5 deletions src/EFCore.Design/Scaffolding/Internal/CSharpUniqueNamer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using System.Collections.Generic;
using JetBrains.Annotations;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand All @@ -28,7 +26,7 @@ public class CSharpUniqueNamer<T> : CSharpNamer<T>
public CSharpUniqueNamer(
[NotNull] Func<T, string> nameGetter,
[NotNull] ICSharpUtilities cSharpUtilities,
[CanBeNull] Func<string, string>? singularizePluralizer)
[CanBeNull] Func<string, string> singularizePluralizer)
: this(nameGetter, null, cSharpUtilities, singularizePluralizer)
{
}
Expand All @@ -41,9 +39,9 @@ public CSharpUniqueNamer(
/// </summary>
public CSharpUniqueNamer(
[NotNull] Func<T, string> nameGetter,
[CanBeNull] IEnumerable<string>? usedNames,
[CanBeNull] IEnumerable<string> usedNames,
[NotNull] ICSharpUtilities cSharpUtilities,
[CanBeNull] Func<string, string>? singularizePluralizer)
[CanBeNull] Func<string, string> singularizePluralizer)
: base(nameGetter, cSharpUtilities, singularizePluralizer)
{
if (usedNames != null)
Expand Down
16 changes: 7 additions & 9 deletions src/EFCore.Design/Scaffolding/Internal/CSharpUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Utilities;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand Down Expand Up @@ -124,8 +122,8 @@ public virtual bool IsCSharpKeyword(string identifier)
/// </summary>
public virtual string GenerateCSharpIdentifier(
string identifier,
ICollection<string>? existingIdentifiers,
Func<string, string>? singularizePluralizer)
ICollection<string> existingIdentifiers,
Func<string, string> singularizePluralizer)
=> GenerateCSharpIdentifier(identifier, existingIdentifiers, singularizePluralizer, Uniquifier);

/// <summary>
Expand All @@ -136,9 +134,9 @@ public virtual string GenerateCSharpIdentifier(
/// </summary>
public virtual string GenerateCSharpIdentifier(
string identifier,
ICollection<string>? existingIdentifiers,
Func<string, string>? singularizePluralizer,
Func<string, ICollection<string>?, string> uniquifier)
ICollection<string> existingIdentifiers,
Func<string, string> singularizePluralizer,
Func<string, ICollection<string>, string> uniquifier)
{
Check.NotNull(identifier, nameof(identifier));
Check.NotNull(uniquifier, nameof(uniquifier));
Expand Down Expand Up @@ -179,7 +177,7 @@ public virtual string GenerateCSharpIdentifier(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual string Uniquifier(
[NotNull] string proposedIdentifier, [CanBeNull] ICollection<string>? existingIdentifiers)
[NotNull] string proposedIdentifier, [CanBeNull] ICollection<string> existingIdentifiers)
{
Check.NotEmpty(proposedIdentifier, nameof(proposedIdentifier));

Expand All @@ -205,7 +203,7 @@ public virtual string Uniquifier(
/// 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>
public virtual bool IsValidIdentifier(string? name)
public virtual bool IsValidIdentifier(string name)
{
if (string.IsNullOrEmpty(name))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
using Microsoft.EntityFrameworkCore.Scaffolding.Metadata;
using Microsoft.EntityFrameworkCore.Utilities;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Metadata;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand All @@ -26,7 +24,7 @@ string WriteCode(
[NotNull] IModel model,
[NotNull] string contextName,
[NotNull] string connectionString,
[CanBeNull] string? contextNamespace,
[CanBeNull] string contextNamespace,
[NotNull] string modelNamespace,
bool useDataAnnotations,
bool suppressConnectionStringWarning,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Metadata;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand Down
12 changes: 5 additions & 7 deletions src/EFCore.Design/Scaffolding/Internal/ICSharpUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using System.Collections.Generic;
using JetBrains.Annotations;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand All @@ -24,8 +22,8 @@ public interface ICSharpUtilities
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
string GenerateCSharpIdentifier(
[NotNull] string identifier, [CanBeNull] ICollection<string>? existingIdentifiers,
[CanBeNull] Func<string, string>? singularizePluralizer);
[NotNull] string identifier, [CanBeNull] ICollection<string> existingIdentifiers,
[CanBeNull] Func<string, string> singularizePluralizer);

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Expand All @@ -34,8 +32,8 @@ string GenerateCSharpIdentifier(
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
string GenerateCSharpIdentifier(
[NotNull] string identifier, [CanBeNull] ICollection<string>? existingIdentifiers,
[CanBeNull] Func<string, string>? singularizePluralizer, [NotNull] Func<string, ICollection<string>?, string> uniquifier);
[NotNull] string identifier, [CanBeNull] ICollection<string> existingIdentifiers,
[CanBeNull] Func<string, string> singularizePluralizer, [NotNull] Func<string, ICollection<string>, string> uniquifier);

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Expand All @@ -51,6 +49,6 @@ string GenerateCSharpIdentifier(
/// 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>
bool IsValidIdentifier([CanBeNull] string? name);
bool IsValidIdentifier([CanBeNull] string name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Scaffolding.Metadata;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Scaffolding.Metadata;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

using JetBrains.Annotations;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand All @@ -21,6 +19,6 @@ public interface IScaffoldingTypeMapper
/// 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>
TypeScaffoldingInfo? FindMapping([NotNull] string storeType, bool keyOrIndex, bool rowVersion);
TypeScaffoldingInfo FindMapping([NotNull] string storeType, bool keyOrIndex, bool rowVersion);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Design.Internal;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
using Microsoft.EntityFrameworkCore.Storage.Internal;
using Microsoft.EntityFrameworkCore.Utilities;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand Down Expand Up @@ -118,7 +116,7 @@ public virtual ScaffoldedModel ScaffoldModel(
}

var databaseModel = _databaseModelFactory.Create(resolvedConnectionString, databaseOptions);
var modelConnectionString = (string?)(databaseModel[ScaffoldingAnnotationNames.ConnectionString]);
var modelConnectionString = (string)(databaseModel[ScaffoldingAnnotationNames.ConnectionString]);
if (!string.IsNullOrEmpty(modelConnectionString))
{
codeOptions.ConnectionString = modelConnectionString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Utilities;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand Down Expand Up @@ -39,7 +37,7 @@ public ScaffoldingTypeMapper([NotNull] IRelationalTypeMappingSource typeMappingS
/// 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>
public virtual TypeScaffoldingInfo? FindMapping(
public virtual TypeScaffoldingInfo FindMapping(
string storeType,
bool keyOrIndex,
bool rowVersion)
Expand Down
2 changes: 0 additions & 2 deletions src/EFCore.Design/Scaffolding/Internal/TypeScaffoldingInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Utilities;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Metadata.Internal
{
/// <summary>
Expand Down Expand Up @@ -38,7 +36,7 @@ public static string DisplayName([NotNull] this DatabaseColumn column)
/// </summary>
public static bool IsKeyOrIndex([NotNull] this DatabaseColumn column)
{
var table = column.Table!;
var table = column.Table;

if (table.PrimaryKey?.Columns.Contains(column) == true)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
using System.Linq;
using JetBrains.Annotations;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Metadata.Internal
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

using JetBrains.Annotations;

#nullable enable

namespace Microsoft.EntityFrameworkCore.Scaffolding.Metadata.Internal
{
/// <summary>
Expand Down
Loading

0 comments on commit 901c042

Please sign in to comment.