Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.1.11: Disable NRTs in scaffolding #23060

Merged
merged 2 commits into from
Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ public class CSharpDbContextGenerator : ICSharpDbContextGenerator

_sb.AppendLine();

_sb.AppendLine("// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled.");
_sb.AppendLine("// If you have enabled NRTs for your project, then un-comment the following line:");
_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,11 @@ public virtual string WriteCode(IEntityType entityType, string @namespace, bool
_sb.AppendLine($"using {ns};");
}

_sb.AppendLine();
_sb.AppendLine("// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled.");
_sb.AppendLine("// If you have enabled NRTs for your project, then un-comment the following line:");
_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,10 @@ public void Empty_model()
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled.
// If you have enabled NRTs for your project, then un-comment the following line:
// #nullable disable

namespace TestNamespace
{
public partial class TestDbContext : DbContext
Expand Down Expand Up @@ -80,6 +84,10 @@ public void SuppressConnectionStringWarning_works()
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled.
// If you have enabled NRTs for your project, then un-comment the following line:
// #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,10 @@ public void Navigation_properties()
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled.
// If you have enabled NRTs for your project, then un-comment the following line:
// #nullable disable

namespace TestNamespace
{
public partial class Post
Expand Down Expand Up @@ -98,6 +102,10 @@ public void Navigation_property_with_same_type_and_navigation_name()
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled.
// If you have enabled NRTs for your project, then un-comment the following line:
// #nullable disable

namespace TestNamespace
{
public partial class Post
Expand Down Expand Up @@ -153,6 +161,10 @@ public void Navigation_property_with_same_type_and_property_name()
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled.
// If you have enabled NRTs for your project, then un-comment the following line:
// #nullable disable

namespace TestNamespace
{
public partial class Post
Expand Down Expand Up @@ -209,6 +221,10 @@ public void Navigation_property_with_same_type_and_other_navigation_name()
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled.
// If you have enabled NRTs for your project, then un-comment the following line:
// #nullable disable

namespace TestNamespace
{
public partial class Post
Expand Down Expand Up @@ -276,6 +292,10 @@ public void Composite_key()
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled.
// If you have enabled NRTs for your project, then un-comment the following line:
// #nullable disable

namespace TestNamespace
{
public partial class Post
Expand Down