From d6b6273e58c59918354b23f21322329b8374bf41 Mon Sep 17 00:00:00 2001 From: Brice Lambson Date: Mon, 8 Aug 2022 15:13:38 -0700 Subject: [PATCH] fixup! Scaffolding: Create default templates Finalize template changes --- .../Design/FluentApiCodeFragment.cs | 7 ++ .../Internal/CSharpDbContextGenerator.cs | 35 +++------ .../Internal/CSharpDbContextGenerator.tt | 35 +++------ .../Internal/CSharpEntityTypeGenerator.cs | 24 +++--- .../Internal/CSharpEntityTypeGenerator.tt | 24 +++--- .../Internal/CSharpDbContextGeneratorTest.cs | 75 ++++++++++++++++--- .../Internal/CSharpEntityTypeGeneratorTest.cs | 12 --- 7 files changed, 110 insertions(+), 102 deletions(-) diff --git a/src/EFCore.Design/Design/FluentApiCodeFragment.cs b/src/EFCore.Design/Design/FluentApiCodeFragment.cs index 8930d142ebd..278cd0eb04d 100644 --- a/src/EFCore.Design/Design/FluentApiCodeFragment.cs +++ b/src/EFCore.Design/Design/FluentApiCodeFragment.cs @@ -117,6 +117,13 @@ public virtual IEnumerable GetRequiredUsings() yield return current.Namespace; } + foreach (var argumentNamespace in current.Arguments + .Where(a => a is not null and not NestedClosureCodeFragment and not PropertyAccessorCodeFragment) + .SelectMany(a => a!.GetType().GetNamespaces())) + { + yield return argumentNamespace; + } + current = current.ChainedCall; } while (current is not null); diff --git a/src/EFCore.Design/Scaffolding/Internal/CSharpDbContextGenerator.cs b/src/EFCore.Design/Scaffolding/Internal/CSharpDbContextGenerator.cs index 1615bfd7241..f9497d6cbb4 100644 --- a/src/EFCore.Design/Scaffolding/Internal/CSharpDbContextGenerator.cs +++ b/src/EFCore.Design/Scaffolding/Internal/CSharpDbContextGenerator.cs @@ -9,13 +9,11 @@ // ------------------------------------------------------------------------------ namespace Microsoft.EntityFrameworkCore.Scaffolding.Internal { - using System.Linq; using System.Collections.Generic; + using System.Linq; using System.Text; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; - using Microsoft.EntityFrameworkCore.Metadata; - using Microsoft.EntityFrameworkCore.Metadata.Conventions; using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.Extensions.DependencyInjection; using System; @@ -32,8 +30,6 @@ public partial class CSharpDbContextGenerator : CSharpDbContextGeneratorBase public virtual string TransformText() { - // TODO: Remove unused directives above - var services = (IServiceProvider)Host; var providerCode = services.GetRequiredService(); var annotationCodeGenerator = services.GetRequiredService(); @@ -43,8 +39,7 @@ public virtual string TransformText() { "System", "System.Collections.Generic", - "Microsoft.EntityFrameworkCore", - "Microsoft.EntityFrameworkCore.Metadata" // TODO: Remove until actually needed + "Microsoft.EntityFrameworkCore" }; if (NamespaceHint != Options.ModelNamespace @@ -140,8 +135,7 @@ public virtual string TransformText() if (anyConfiguration) { - // TODO: Try with trailing newlines instead - WriteLine(); + WriteLine(""); } var anyEntityTypeConfiguration = false; @@ -181,7 +175,7 @@ public virtual string TransformText() if (anyEntityTypeConfiguration) { - WriteLine(); + WriteLine(""); } this.Write(" entity"); @@ -196,7 +190,7 @@ public virtual string TransformText() { if (anyEntityTypeConfiguration) { - WriteLine(); + WriteLine(""); } var indexFluentApiCalls = index.GetFluentApiCalls(annotationCodeGenerator); @@ -219,11 +213,9 @@ public virtual string TransformText() var firstProperty = true; foreach (var property in entityType.GetProperties()) { - // TODO: Issue to include things handled by conventions var propertyFluentApiCalls = property.GetFluentApiCalls(annotationCodeGenerator) ?.FilterChain(c => !(Options.UseDataAnnotations && c.HasDataAnnotation) - // TODO: Helper methods? - && !(c.Method == "IsRequired" && !property.ClrType.IsValueType && Options.UseNullableReferenceTypes)); + && !(c.Method == "IsRequired" && Options.UseNullableReferenceTypes && !property.ClrType.IsValueType)); if (propertyFluentApiCalls == null) { continue; @@ -233,7 +225,7 @@ public virtual string TransformText() if (anyEntityTypeConfiguration && firstProperty) { - WriteLine(); + WriteLine(""); } this.Write(" entity.Property(e => e."); @@ -259,7 +251,7 @@ public virtual string TransformText() if (anyEntityTypeConfiguration) { - WriteLine(); + WriteLine(""); } this.Write(" entity.HasOne(d => d."); @@ -275,12 +267,11 @@ public virtual string TransformText() anyEntityTypeConfiguration = true; } - // TODO: This is complex. Can we combine with the entity type code above? Can we move chunks into helper methods? foreach (var skipNavigation in entityType.GetSkipNavigations().Where(n => n.IsLeftNavigation())) { if (anyEntityTypeConfiguration) { - WriteLine(); + WriteLine(""); } var left = skipNavigation.ForeignKey; @@ -396,7 +387,7 @@ public virtual string TransformText() if (anyConfiguration) { - WriteLine(); + WriteLine(""); } this.Write(" OnModelCreatingPartial(modelBuilder);\r\n }\r\n\r\n partial void OnModelC" + @@ -414,7 +405,7 @@ public virtual string TransformText() } - WriteLine(); + WriteLine(""); GenerationEnvironment.Append(mainEnvironment); @@ -436,10 +427,6 @@ public virtual string TransformText() } } - void WriteLine() - => WriteLine(""); - - private global::Microsoft.EntityFrameworkCore.Metadata.IModel _ModelField; /// diff --git a/src/EFCore.Design/Scaffolding/Internal/CSharpDbContextGenerator.tt b/src/EFCore.Design/Scaffolding/Internal/CSharpDbContextGenerator.tt index 7defb4aa6e3..ca6309261e9 100644 --- a/src/EFCore.Design/Scaffolding/Internal/CSharpDbContextGenerator.tt +++ b/src/EFCore.Design/Scaffolding/Internal/CSharpDbContextGenerator.tt @@ -6,18 +6,14 @@ <#@ parameter name="Model" type="Microsoft.EntityFrameworkCore.Metadata.IModel" #> <#@ parameter name="Options" type="Microsoft.EntityFrameworkCore.Scaffolding.ModelCodeGenerationOptions" #> <#@ parameter name="NamespaceHint" type="System.String" #> -<#@ import namespace="System.Linq" #> <#@ import namespace="System.Collections.Generic" #> +<#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="Microsoft.EntityFrameworkCore" #> <#@ import namespace="Microsoft.EntityFrameworkCore.Design" #> -<#@ import namespace="Microsoft.EntityFrameworkCore.Metadata" #> -<#@ import namespace="Microsoft.EntityFrameworkCore.Metadata.Conventions" #> <#@ import namespace="Microsoft.EntityFrameworkCore.Scaffolding" #> <#@ import namespace="Microsoft.Extensions.DependencyInjection" #> <# - // TODO: Remove unused directives above - var services = (IServiceProvider)Host; var providerCode = services.GetRequiredService(); var annotationCodeGenerator = services.GetRequiredService(); @@ -27,8 +23,7 @@ { "System", "System.Collections.Generic", - "Microsoft.EntityFrameworkCore", - "Microsoft.EntityFrameworkCore.Metadata" // TODO: Remove until actually needed + "Microsoft.EntityFrameworkCore" }; if (NamespaceHint != Options.ModelNamespace @@ -114,8 +109,7 @@ public partial class <#= Options.ContextName #> : DbContext if (anyConfiguration) { - // TODO: Try with trailing newlines instead - WriteLine(); + WriteLine(""); } var anyEntityTypeConfiguration = false; @@ -150,7 +144,7 @@ public partial class <#= Options.ContextName #> : DbContext if (anyEntityTypeConfiguration) { - WriteLine(); + WriteLine(""); } #> entity<#= code.Fragment(entityTypeFluentApiCalls, indent: 4) #>; @@ -163,7 +157,7 @@ public partial class <#= Options.ContextName #> : DbContext { if (anyEntityTypeConfiguration) { - WriteLine(); + WriteLine(""); } var indexFluentApiCalls = index.GetFluentApiCalls(annotationCodeGenerator); @@ -180,11 +174,9 @@ public partial class <#= Options.ContextName #> : DbContext var firstProperty = true; foreach (var property in entityType.GetProperties()) { - // TODO: Issue to include things handled by conventions var propertyFluentApiCalls = property.GetFluentApiCalls(annotationCodeGenerator) ?.FilterChain(c => !(Options.UseDataAnnotations && c.HasDataAnnotation) - // TODO: Helper methods? - && !(c.Method == "IsRequired" && !property.ClrType.IsValueType && Options.UseNullableReferenceTypes)); + && !(c.Method == "IsRequired" && Options.UseNullableReferenceTypes && !property.ClrType.IsValueType)); if (propertyFluentApiCalls == null) { continue; @@ -194,7 +186,7 @@ public partial class <#= Options.ContextName #> : DbContext if (anyEntityTypeConfiguration && firstProperty) { - WriteLine(); + WriteLine(""); } #> entity.Property(e => e.<#= property.Name #>)<#= code.Fragment(propertyFluentApiCalls, indent: 4) #>; @@ -216,7 +208,7 @@ public partial class <#= Options.ContextName #> : DbContext if (anyEntityTypeConfiguration) { - WriteLine(); + WriteLine(""); } #> entity.HasOne(d => d.<#= foreignKey.DependentToPrincipal.Name #>).<#= foreignKey.IsUnique ? "WithOne" : "WithMany" #>(p => p.<#= foreignKey.PrincipalToDependent.Name #>)<#= code.Fragment(foreignKeyFluentApiCalls, indent: 4) #>; @@ -224,12 +216,11 @@ public partial class <#= Options.ContextName #> : DbContext anyEntityTypeConfiguration = true; } - // TODO: This is complex. Can we combine with the entity type code above? Can we move chunks into helper methods? foreach (var skipNavigation in entityType.GetSkipNavigations().Where(n => n.IsLeftNavigation())) { if (anyEntityTypeConfiguration) { - WriteLine(); + WriteLine(""); } var left = skipNavigation.ForeignKey; @@ -317,7 +308,7 @@ public partial class <#= Options.ContextName #> : DbContext if (anyConfiguration) { - WriteLine(); + WriteLine(""); } #> OnModelCreatingPartial(modelBuilder); @@ -336,11 +327,7 @@ using <#= ns #>; <# } - WriteLine(); + WriteLine(""); GenerationEnvironment.Append(mainEnvironment); #> -<#+ - void WriteLine() - => WriteLine(""); -#> diff --git a/src/EFCore.Design/Scaffolding/Internal/CSharpEntityTypeGenerator.cs b/src/EFCore.Design/Scaffolding/Internal/CSharpEntityTypeGenerator.cs index eb4140e4021..7a2db72cc6b 100644 --- a/src/EFCore.Design/Scaffolding/Internal/CSharpEntityTypeGenerator.cs +++ b/src/EFCore.Design/Scaffolding/Internal/CSharpEntityTypeGenerator.cs @@ -91,7 +91,7 @@ public virtual string TransformText() { if (!firstProperty) { - WriteLine(); + WriteLine(""); } if (!string.IsNullOrEmpty(property.GetComment())) @@ -106,7 +106,7 @@ public virtual string TransformText() if (Options.UseDataAnnotations) { var dataAnnotations = property.GetDataAnnotations(annotationCodeGenerator) - .Where(a => !(a.Type == typeof(RequiredAttribute) && !property.ClrType.IsValueType && Options.UseNullableReferenceTypes)); + .Where(a => !(a.Type == typeof(RequiredAttribute) && Options.UseNullableReferenceTypes && !property.ClrType.IsValueType)); foreach (var dataAnnotation in dataAnnotations) { @@ -119,9 +119,8 @@ public virtual string TransformText() usings.AddRange(code.GetRequiredUsings(property.ClrType)); - // TODO: Helper methods? - var needsNullable = property.IsNullable && !property.ClrType.IsValueType && Options.UseNullableReferenceTypes; - var needsInitializer = !property.IsNullable && !property.ClrType.IsValueType && Options.UseNullableReferenceTypes; + var needsNullable = Options.UseNullableReferenceTypes && property.IsNullable && !property.ClrType.IsValueType; + var needsInitializer = Options.UseNullableReferenceTypes && !property.IsNullable && !property.ClrType.IsValueType; this.Write(" public "); this.Write(this.ToStringHelper.ToStringWithCulture(code.Reference(property.ClrType))); @@ -137,7 +136,7 @@ public virtual string TransformText() foreach (var navigation in EntityType.GetNavigations()) { - WriteLine(); + WriteLine(""); if (Options.UseDataAnnotations) { @@ -166,9 +165,8 @@ public virtual string TransformText() } else { - // TODO: Helper methods? - var needsNullable = !(navigation.ForeignKey.IsRequired && navigation.IsOnDependent) && Options.UseNullableReferenceTypes; - var needsInitializer = navigation.ForeignKey.IsRequired && navigation.IsOnDependent && Options.UseNullableReferenceTypes; + var needsNullable = Options.UseNullableReferenceTypes && !(navigation.ForeignKey.IsRequired && navigation.IsOnDependent); + var needsInitializer = Options.UseNullableReferenceTypes && navigation.ForeignKey.IsRequired && navigation.IsOnDependent; this.Write(" public virtual "); this.Write(this.ToStringHelper.ToStringWithCulture(targetType)); @@ -184,7 +182,7 @@ public virtual string TransformText() foreach (var skipNavigation in EntityType.GetSkipNavigations()) { - WriteLine(); + WriteLine(""); if (Options.UseDataAnnotations) { @@ -222,7 +220,7 @@ public virtual string TransformText() } - WriteLine(); + WriteLine(""); GenerationEnvironment.Append(previousOutput); @@ -244,10 +242,6 @@ public virtual string TransformText() } } - void WriteLine() - => WriteLine(""); - - private global::Microsoft.EntityFrameworkCore.Metadata.IEntityType _EntityTypeField; /// diff --git a/src/EFCore.Design/Scaffolding/Internal/CSharpEntityTypeGenerator.tt b/src/EFCore.Design/Scaffolding/Internal/CSharpEntityTypeGenerator.tt index ed4ba802113..a0a6605d03b 100644 --- a/src/EFCore.Design/Scaffolding/Internal/CSharpEntityTypeGenerator.tt +++ b/src/EFCore.Design/Scaffolding/Internal/CSharpEntityTypeGenerator.tt @@ -72,7 +72,7 @@ public partial class <#= EntityType.Name #> { if (!firstProperty) { - WriteLine(); + WriteLine(""); } if (!string.IsNullOrEmpty(property.GetComment())) @@ -87,7 +87,7 @@ public partial class <#= EntityType.Name #> if (Options.UseDataAnnotations) { var dataAnnotations = property.GetDataAnnotations(annotationCodeGenerator) - .Where(a => !(a.Type == typeof(RequiredAttribute) && !property.ClrType.IsValueType && Options.UseNullableReferenceTypes)); + .Where(a => !(a.Type == typeof(RequiredAttribute) && Options.UseNullableReferenceTypes && !property.ClrType.IsValueType)); foreach (var dataAnnotation in dataAnnotations) { #> @@ -98,9 +98,8 @@ public partial class <#= EntityType.Name #> usings.AddRange(code.GetRequiredUsings(property.ClrType)); - // TODO: Helper methods? - var needsNullable = property.IsNullable && !property.ClrType.IsValueType && Options.UseNullableReferenceTypes; - var needsInitializer = !property.IsNullable && !property.ClrType.IsValueType && Options.UseNullableReferenceTypes; + var needsNullable = Options.UseNullableReferenceTypes && property.IsNullable && !property.ClrType.IsValueType; + var needsInitializer = Options.UseNullableReferenceTypes && !property.IsNullable && !property.ClrType.IsValueType; #> public <#= code.Reference(property.ClrType) #><#= needsNullable ? "?" : "" #> <#= property.Name #> { get; set; }<#= needsInitializer ? " = null!;" : "" #> <# @@ -109,7 +108,7 @@ public partial class <#= EntityType.Name #> foreach (var navigation in EntityType.GetNavigations()) { - WriteLine(); + WriteLine(""); if (Options.UseDataAnnotations) { @@ -130,9 +129,8 @@ public partial class <#= EntityType.Name #> } else { - // TODO: Helper methods? - var needsNullable = !(navigation.ForeignKey.IsRequired && navigation.IsOnDependent) && Options.UseNullableReferenceTypes; - var needsInitializer = navigation.ForeignKey.IsRequired && navigation.IsOnDependent && Options.UseNullableReferenceTypes; + var needsNullable = Options.UseNullableReferenceTypes && !(navigation.ForeignKey.IsRequired && navigation.IsOnDependent); + var needsInitializer = Options.UseNullableReferenceTypes && navigation.ForeignKey.IsRequired && navigation.IsOnDependent; #> public virtual <#= targetType #><#= needsNullable ? "?" : "" #> <#= navigation.Name #> { get; set; }<#= needsInitializer ? " = null!;" : "" #> <# @@ -141,7 +139,7 @@ public partial class <#= EntityType.Name #> foreach (var skipNavigation in EntityType.GetSkipNavigations()) { - WriteLine(); + WriteLine(""); if (Options.UseDataAnnotations) { @@ -169,11 +167,7 @@ using <#= ns #>; <# } - WriteLine(); + WriteLine(""); GenerationEnvironment.Append(previousOutput); #> -<#+ - void WriteLine() - => WriteLine(""); -#> diff --git a/test/EFCore.Design.Tests/Scaffolding/Internal/CSharpDbContextGeneratorTest.cs b/test/EFCore.Design.Tests/Scaffolding/Internal/CSharpDbContextGeneratorTest.cs index fbd12558cd9..50dc5a94c2b 100644 --- a/test/EFCore.Design.Tests/Scaffolding/Internal/CSharpDbContextGeneratorTest.cs +++ b/test/EFCore.Design.Tests/Scaffolding/Internal/CSharpDbContextGeneratorTest.cs @@ -31,7 +31,6 @@ public void Empty_model() @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -77,7 +76,6 @@ public void SuppressConnectionStringWarning_works() @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -120,7 +118,6 @@ public void SuppressOnConfiguring_works() @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -562,7 +559,6 @@ public void Entity_with_indexes_and_use_data_annotations_false_always_generates_ @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -638,7 +634,6 @@ public void Entity_with_indexes_and_use_data_annotations_true_generates_fluent_A @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -713,7 +708,6 @@ public void Indexes_with_descending() @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -813,7 +807,6 @@ public void Entity_lambda_uses_correct_identifiers() @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -886,7 +879,6 @@ public void Column_type_is_not_scaffolded_as_annotation() @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -957,7 +949,6 @@ public void Global_namespace_works() @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; public partial class TestDbContext : DbContext { @@ -1043,7 +1034,6 @@ public void Fluent_calls_in_custom_namespaces_work() using System.Collections.Generic; using CustomTestNamespace; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -1094,7 +1084,6 @@ public void Temporal_table_works() @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -1202,7 +1191,6 @@ public void Trigger_works() @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -1256,6 +1244,69 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) t => Assert.Equal("Trigger2", t.Name)); }); + [ConditionalFact] + public void ValueGenerationStrategy_works_when_none() + => Test( + modelBuilder => modelBuilder.Entity( + "Channel", + x => + { + x.Property("Id") + .Metadata.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.None); + }), + new ModelCodeGenerationOptions(), + code => + { + AssertFileContents( + @"using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; + +namespace TestNamespace; + +public partial class TestDbContext : DbContext +{ + public TestDbContext() + { + } + + public TestDbContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet Channel { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) +#warning " + + DesignStrings.SensitiveInformationWarning + + @" + => optionsBuilder.UseSqlServer(""Initial Catalog=TestDatabase""); + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity(entity => + { + entity.Property(e => e.Id).HasAnnotation(""SqlServer:ValueGenerationStrategy"", SqlServerValueGenerationStrategy.None); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} +", + code.ContextFile); + + }, + model => + { + var entityType = Assert.Single(model.GetEntityTypes()); + var property = Assert.Single(entityType.GetProperties()); + Assert.Equal(SqlServerValueGenerationStrategy.None, property.GetValueGenerationStrategy()); + }); + protected override void AddModelServices(IServiceCollection services) => services.Replace(ServiceDescriptor.Singleton()); diff --git a/test/EFCore.Design.Tests/Scaffolding/Internal/CSharpEntityTypeGeneratorTest.cs b/test/EFCore.Design.Tests/Scaffolding/Internal/CSharpEntityTypeGeneratorTest.cs index 2e7c53d029d..7047e0680e8 100644 --- a/test/EFCore.Design.Tests/Scaffolding/Internal/CSharpEntityTypeGeneratorTest.cs +++ b/test/EFCore.Design.Tests/Scaffolding/Internal/CSharpEntityTypeGeneratorTest.cs @@ -42,7 +42,6 @@ public partial class Vista @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -414,7 +413,6 @@ public partial class EntityWithIndexes @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -492,7 +490,6 @@ public partial class Entity @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -572,7 +569,6 @@ public partial class Post @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -1049,7 +1045,6 @@ public partial class Entity @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -1510,7 +1505,6 @@ public partial class Post @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -1615,7 +1609,6 @@ public partial class Post @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -1884,7 +1877,6 @@ public partial class EntityWithAnnotation @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -1962,7 +1954,6 @@ public partial class EntityWithPropertyAnnotation @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -2025,7 +2016,6 @@ public void Scaffold_skip_navigations_default() @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -2157,7 +2147,6 @@ public void Scaffold_skip_navigations_different_key_type() @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace; @@ -2284,7 +2273,6 @@ public void Scaffold_skip_navigations_default_data_annotations() @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; namespace TestNamespace;