Skip to content

Commit

Permalink
Disable NRTs in scaffolding (#21190)
Browse files Browse the repository at this point in the history
Part of #15520

(cherry picked from commit 0b50d83)
  • Loading branch information
roji authored and ajcvickers committed Nov 12, 2020
1 parent 5003c12 commit f57176c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ public virtual string WriteCode(

_sb.AppendLine();

_sb.AppendLine("#nullable disable");
_sb.AppendLine();

_sb.AppendLine($"namespace {finalContextNamespace}");
_sb.AppendLine("{");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public virtual string WriteCode(IEntityType entityType, string @namespace, bool
_sb.AppendLine($"using {ns};");
}

_sb.AppendLine();
_sb.AppendLine("#nullable disable");

_sb.AppendLine();
_sb.AppendLine($"namespace {@namespace}");
_sb.AppendLine("{");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public void Empty_model()
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
#nullable disable
namespace TestNamespace
{
public partial class TestDbContext : DbContext
Expand Down Expand Up @@ -80,6 +82,8 @@ public void SuppressConnectionStringWarning_works()
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
#nullable disable
namespace TestNamespace
{
public partial class TestDbContext : DbContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public void Navigation_properties()
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
namespace TestNamespace
{
public partial class Post
Expand Down Expand Up @@ -98,6 +100,8 @@ public void Navigation_property_with_same_type_and_navigation_name()
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
namespace TestNamespace
{
public partial class Post
Expand Down Expand Up @@ -153,6 +157,8 @@ public void Navigation_property_with_same_type_and_property_name()
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
namespace TestNamespace
{
public partial class Post
Expand Down Expand Up @@ -209,6 +215,8 @@ public void Navigation_property_with_same_type_and_other_navigation_name()
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
namespace TestNamespace
{
public partial class Post
Expand Down Expand Up @@ -276,6 +284,8 @@ public void Composite_key()
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
namespace TestNamespace
{
public partial class Post
Expand Down

0 comments on commit f57176c

Please sign in to comment.