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

Disable nullability in migrations #25626

Merged
merged 1 commit into from
Aug 20, 2021
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
12 changes: 12 additions & 0 deletions src/EFCore.Design/Migrations/Design/CSharpMigrationsGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ public override string GenerateMigration(
.AppendLine(";");
}

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

if (!string.IsNullOrEmpty(migrationNamespace))
{
builder
Expand Down Expand Up @@ -184,6 +188,10 @@ public override string GenerateMetadata(
.AppendLine(";");
}

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

if (!string.IsNullOrEmpty(migrationNamespace))
{
builder
Expand Down Expand Up @@ -276,6 +284,10 @@ public override string GenerateSnapshot(
.AppendLine(";");
}

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

if (!string.IsNullOrEmpty(modelSnapshotNamespace))
{
builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ public void Migrations_compile()
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;

#nullable disable

namespace MyNamespace
{
public partial class MyMigration : Migration
Expand Down Expand Up @@ -578,6 +580,8 @@ protected override void Down(MigrationBuilder migrationBuilder)
using Microsoft.EntityFrameworkCore.Migrations.Design;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace MyNamespace
{
[DbContext(typeof(CSharpMigrationsGeneratorTest.MyContext))]
Expand Down Expand Up @@ -708,6 +712,8 @@ public void Snapshots_compile()
using Microsoft.EntityFrameworkCore.Migrations.Design;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace MyNamespace
{
[DbContext(typeof(CSharpMigrationsGeneratorTest.MyContext))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2582,6 +2582,8 @@ public virtual void Owned_types_can_be_mapped_to_view()
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace RootNamespace
{
[DbContext(typeof(DbContext))]
Expand Down Expand Up @@ -2665,6 +2667,8 @@ public virtual void Snapshot_with_OwnedNavigationBuilder_HasCheckConstraint_comp
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace RootNamespace
{
[DbContext(typeof(DbContext))]
Expand Down Expand Up @@ -5292,6 +5296,8 @@ static List<IProperty> getAllProperties(IModel model)
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using NetTopologySuite.Geometries;

#nullable disable

namespace RootNamespace
{
[DbContext(typeof(DbContext))]
Expand Down Expand Up @@ -5674,6 +5680,8 @@ protected virtual string AddBoilerPlate(string code, bool usingSystem = false)
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace RootNamespace
{{
[DbContext(typeof(DbContext))]
Expand Down