Skip to content

Commit

Permalink
Migrations: Disable obsolete warnings in designer files
Browse files Browse the repository at this point in the history
Fixes #8703
  • Loading branch information
bricelam committed Jun 7, 2017
1 parent b82048c commit 037755e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
30 changes: 26 additions & 4 deletions src/EFCore.Design/Migrations/Design/CSharpMigrationsGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,24 @@ public override string GenerateMetadata(
{
builder
.AppendLine("protected override void BuildTargetModel(ModelBuilder modelBuilder)")
.AppendLine("{");
.AppendLine("{")
.DecrementIndent()
.DecrementIndent()
.AppendLine("#pragma warning disable 612, 618")
.IncrementIndent()
.IncrementIndent();
using (builder.Indent())
{
// TODO: Optimize. This is repeated below
CSharpDependencies.CSharpSnapshotGenerator.Generate("modelBuilder", targetModel, builder);
}
builder.AppendLine("}");
builder
.DecrementIndent()
.DecrementIndent()
.AppendLine("#pragma warning restore 612, 618")
.IncrementIndent()
.IncrementIndent()
.AppendLine("}");
}
builder.AppendLine("}");
}
Expand Down Expand Up @@ -210,12 +221,23 @@ public override string GenerateSnapshot(
{
builder
.AppendLine("protected override void BuildModel(ModelBuilder modelBuilder)")
.AppendLine("{");
.AppendLine("{")
.DecrementIndent()
.DecrementIndent()
.AppendLine("#pragma warning disable 612, 618")
.IncrementIndent()
.IncrementIndent();
using (builder.Indent())
{
CSharpDependencies.CSharpSnapshotGenerator.Generate("modelBuilder", model, builder);
}
builder.AppendLine("}");
builder
.DecrementIndent()
.DecrementIndent()
.AppendLine("#pragma warning restore 612, 618")
.IncrementIndent()
.IncrementIndent()
.AppendLine("}");
}
builder.AppendLine("}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ partial class MyMigration
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation(""Some:EnumValue"", RegexOptions.Multiline);
#pragma warning restore 612, 618
}
}
}
Expand Down Expand Up @@ -198,6 +200,7 @@ partial class MySnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation(""Some:EnumValue"", RegexOptions.Multiline);
Expand All @@ -207,6 +210,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable(""Cheese"");
});
#pragma warning restore 612, 618
}
}
}
Expand Down

0 comments on commit 037755e

Please sign in to comment.