-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop scaffolding IsTableExcludedFromMigrations (#21719)
Fixes #21470
- Loading branch information
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
test/EFCore.Relational.Tests/Design/AnnotationCodeGeneratorTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Linq; | ||
using Microsoft.EntityFrameworkCore.Metadata; | ||
using Microsoft.EntityFrameworkCore.Storage; | ||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
using Xunit; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Design | ||
{ | ||
public class AnnotationCodeGeneratorTest | ||
{ | ||
[ConditionalFact] | ||
public void IsTableExcludedFromMigrations_false_is_handled_by_convention() | ||
{ | ||
var modelBuilder = CreateModelBuilder(); | ||
modelBuilder.Entity("foo").ToTable("foo"); | ||
var entityType = modelBuilder.Model.GetEntityTypes().Single(); | ||
|
||
var annotations = entityType.GetAnnotations().ToDictionary(a => a.Name, a => a); | ||
CreateGenerator().RemoveAnnotationsHandledByConventions(entityType, annotations); | ||
|
||
Assert.DoesNotContain(RelationalAnnotationNames.IsTableExcludedFromMigrations, annotations.Keys); | ||
} | ||
|
||
private ModelBuilder CreateModelBuilder() => RelationalTestHelpers.Instance.CreateConventionBuilder(); | ||
|
||
private AnnotationCodeGenerator CreateGenerator() => new AnnotationCodeGenerator( | ||
new AnnotationCodeGeneratorDependencies( | ||
new TestRelationalTypeMappingSource( | ||
TestServiceFactory.Instance.Create<TypeMappingSourceDependencies>(), | ||
TestServiceFactory.Instance.Create<RelationalTypeMappingSourceDependencies>()))); | ||
} | ||
} |