Skip to content

Commit

Permalink
Fix VS build break due to nullable annotations in scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
smitpatel committed Jan 6, 2020
1 parent e2ba1c8 commit c23a971
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class DatabaseForeignKey : Annotatable
{
public DatabaseForeignKey(
[NotNull] DatabaseTable table,
[NotNull] string name,
[CanBeNull] string? name,
[NotNull] DatabaseTable principalTable)
{
Table = table;
Expand Down Expand Up @@ -51,7 +51,7 @@ public DatabaseForeignKey(
/// <summary>
/// The foreign key constraint name.
/// </summary>
public virtual string Name { get; [param: NotNull] set; }
public virtual string? Name { get; [param: CanBeNull] set; }

/// <summary>
/// The action performed by the database when a row constrained by this foreign key
Expand Down
4 changes: 2 additions & 2 deletions src/EFCore.Relational/Scaffolding/Metadata/DatabaseIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Microsoft.EntityFrameworkCore.Scaffolding.Metadata
/// </summary>
public class DatabaseIndex : Annotatable
{
public DatabaseIndex([NotNull] DatabaseTable table, [NotNull] string name)
public DatabaseIndex([NotNull] DatabaseTable table, [CanBeNull] string? name)
{
Table = table;
Name = name;
Expand All @@ -29,7 +29,7 @@ public DatabaseIndex([NotNull] DatabaseTable table, [NotNull] string name)
/// <summary>
/// The index name.
/// </summary>
public virtual string Name { get; [param: NotNull] set; }
public virtual string? Name { get; [param: CanBeNull] set; }

/// <summary>
/// The ordered list of columns that make up the index.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Microsoft.EntityFrameworkCore.Scaffolding.Metadata
/// </summary>
public class DatabaseUniqueConstraint : Annotatable
{
public DatabaseUniqueConstraint([NotNull] DatabaseTable table, [NotNull] string name)
public DatabaseUniqueConstraint([NotNull] DatabaseTable table, [CanBeNull] string? name)
{
Table = table;
Name = name;
Expand All @@ -29,7 +29,7 @@ public DatabaseUniqueConstraint([NotNull] DatabaseTable table, [NotNull] string
/// <summary>
/// The name of the constraint.
/// </summary>
public virtual string Name { get; [param: NotNull] set; }
public virtual string? Name { get; [param: CanBeNull] set; }

/// <summary>
/// The ordered list of columns that make up the constraint.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using System.Diagnostics.CodeAnalysis;
using JB = JetBrains.Annotations;

#nullable enable

namespace Microsoft.EntityFrameworkCore.SqlServer.Scaffolding.Internal
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1108,10 +1108,10 @@ FROM sys.databases
return result != null ? Convert.ToByte(result) : (byte)0;
}

private static string DisplayName(string? schema, string name)
private static string DisplayName(string? schema, string? name)
=> (!string.IsNullOrEmpty(schema) ? schema + "." : "") + name;

private static ReferentialAction? ConvertToReferentialAction(string onDeleteAction)
private static ReferentialAction? ConvertToReferentialAction(string? onDeleteAction)
{
switch (onDeleteAction)
{
Expand Down

0 comments on commit c23a971

Please sign in to comment.