From 0af7fef41b05ea3407a19de7e9547b40d913893e Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Mon, 26 Sep 2022 17:41:01 +0330 Subject: [PATCH 01/21] Fix Net 7 Support --- .../EFCore.SqlServer.HierarchyId.csproj | 2 +- .../Storage/SqlServerHierarchyIdTypeMapping.cs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/EFCore.SqlServer.HierarchyId/EFCore.SqlServer.HierarchyId.csproj b/EFCore.SqlServer.HierarchyId/EFCore.SqlServer.HierarchyId.csproj index 0c73f7f..9bb3f70 100644 --- a/EFCore.SqlServer.HierarchyId/EFCore.SqlServer.HierarchyId.csproj +++ b/EFCore.SqlServer.HierarchyId/EFCore.SqlServer.HierarchyId.csproj @@ -17,7 +17,7 @@ - + diff --git a/EFCore.SqlServer.HierarchyId/Storage/SqlServerHierarchyIdTypeMapping.cs b/EFCore.SqlServer.HierarchyId/Storage/SqlServerHierarchyIdTypeMapping.cs index 96dfbd3..7321918 100644 --- a/EFCore.SqlServer.HierarchyId/Storage/SqlServerHierarchyIdTypeMapping.cs +++ b/EFCore.SqlServer.HierarchyId/Storage/SqlServerHierarchyIdTypeMapping.cs @@ -85,8 +85,7 @@ protected override string GenerateNonNullSqlLiteral(object value) //command, and the value is already a hierarchyid return $"'{value}'"; } - - public override DbParameter CreateParameter(DbCommand command, string name, object value, bool? nullable = null) + public override DbParameter CreateParameter(DbCommand command, string name, object value, bool? nullable = null, ParameterDirection direction = ParameterDirection.Input) { var parameter = command.CreateParameter(); parameter.Direction = ParameterDirection.Input; From 2c7e003c3bb8701fa33c06f20b6eea710a7e3cd9 Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Mon, 26 Sep 2022 17:41:51 +0330 Subject: [PATCH 02/21] Fix InMemory --- EFCore.InMemory.HierarchyId/EFCore.InMemory.HierarchyId.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EFCore.InMemory.HierarchyId/EFCore.InMemory.HierarchyId.csproj b/EFCore.InMemory.HierarchyId/EFCore.InMemory.HierarchyId.csproj index b6bda45..1937207 100644 --- a/EFCore.InMemory.HierarchyId/EFCore.InMemory.HierarchyId.csproj +++ b/EFCore.InMemory.HierarchyId/EFCore.InMemory.HierarchyId.csproj @@ -12,7 +12,7 @@ - + From 7b7fe28b9d16aaac4e90202919dafdc2c8f8b752 Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Tue, 27 Sep 2022 19:37:09 +0330 Subject: [PATCH 03/21] Add support to EF 7.0 #111 --- .../CSharpDbContextGeneratorTest.cs | 41 +++++++-------- .../CSharpEntityTypeGeneratorTest.cs | 51 +++++++++---------- .../EFCore.SqlServer.HierarchyId.Test.csproj | 14 ++--- .../Migrations/AnonymousArraySeedContext.cs | 23 +++++---- .../Migrations/TypedArraySeedContext.cs | 41 ++++++++------- .../Utilities/FakeScaffoldingModelFactory.cs | 2 +- .../Test/Utilities/SqlServerTestHelpers.cs | 8 ++- 7 files changed, 93 insertions(+), 87 deletions(-) diff --git a/EFCore.SqlServer.HierarchyId.Test/CSharpDbContextGeneratorTest.cs b/EFCore.SqlServer.HierarchyId.Test/CSharpDbContextGeneratorTest.cs index d9805e2..dbb660d 100644 --- a/EFCore.SqlServer.HierarchyId.Test/CSharpDbContextGeneratorTest.cs +++ b/EFCore.SqlServer.HierarchyId.Test/CSharpDbContextGeneratorTest.cs @@ -29,39 +29,32 @@ public void Generates_context_with_UseHierarchyId() @"using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; -namespace TestNamespace +namespace TestNamespace; + +public partial class TestDbContext : DbContext { - public partial class TestDbContext : DbContext + public TestDbContext() { - public TestDbContext() - { - } + } - public TestDbContext(DbContextOptions options) - : base(options) - { - } + public TestDbContext(DbContextOptions options) + : base(options) + { + } - public virtual DbSet Patriarch { get; set; } + public virtual DbSet Patriarch { get; set; } - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - if (!optionsBuilder.IsConfigured) - { + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) #warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263. - optionsBuilder.UseSqlServer(""Initial Catalog=TestDatabase"", x => x.UseHierarchyId()); - } - } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - OnModelCreatingPartial(modelBuilder); - } + => optionsBuilder.UseSqlServer(""Initial Catalog=TestDatabase"", x => x.UseHierarchyId()); - partial void OnModelCreatingPartial(ModelBuilder modelBuilder); + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + OnModelCreatingPartial(modelBuilder); } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); } ", code.ContextFile); diff --git a/EFCore.SqlServer.HierarchyId.Test/CSharpEntityTypeGeneratorTest.cs b/EFCore.SqlServer.HierarchyId.Test/CSharpEntityTypeGeneratorTest.cs index 0ead6c4..4dd7005 100644 --- a/EFCore.SqlServer.HierarchyId.Test/CSharpEntityTypeGeneratorTest.cs +++ b/EFCore.SqlServer.HierarchyId.Test/CSharpEntityTypeGeneratorTest.cs @@ -29,16 +29,15 @@ public void Class_with_HierarchyId_key_is_generated() using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; -namespace TestNamespace +namespace TestNamespace; + +public partial class Patriarch { - public partial class Patriarch - { - [Key] - public HierarchyId Id { get; set; } - public string Name { get; set; } - } + [Key] + public HierarchyId Id { get; set; } + + public string Name { get; set; } } ", code.AdditionalFiles.Single(f => f.Path == "Patriarch.cs")); @@ -68,17 +67,17 @@ public void Class_with_HierarchyId_property_is_generated() using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; -namespace TestNamespace +namespace TestNamespace; + +public partial class Patriarch { - public partial class Patriarch - { - [Key] - public int Id { get; set; } - public HierarchyId Hierarchy { get; set; } - public string Name { get; set; } - } + [Key] + public int Id { get; set; } + + public HierarchyId Hierarchy { get; set; } + + public string Name { get; set; } } ", code.AdditionalFiles.Single(f => f.Path == "Patriarch.cs")); @@ -108,17 +107,17 @@ public void Class_with_multiple_HierarchyId_properties_are_generated() using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; -namespace TestNamespace +namespace TestNamespace; + +public partial class Patriarch { - public partial class Patriarch - { - [Key] - public HierarchyId Id { get; set; } - public HierarchyId Hierarchy { get; set; } - public string Name { get; set; } - } + [Key] + public HierarchyId Id { get; set; } + + public HierarchyId Hierarchy { get; set; } + + public string Name { get; set; } } ", code.AdditionalFiles.Single(f => f.Path == "Patriarch.cs")); diff --git a/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj b/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj index 9de2adc..2036bf1 100644 --- a/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj +++ b/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj @@ -1,20 +1,20 @@ - net6.0 + net7.0 false EntityFrameworkCore.SqlServer.HierarchyId.Test Microsoft.EntityFrameworkCore.SqlServer - - - - + + + + - - + + diff --git a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs index f93630b..eaca9bd 100644 --- a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs +++ b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs @@ -32,18 +32,22 @@ public override string GetExpectedMigrationCode(string migrationName, string roo #nullable disable -namespace {rootNamespace}.Migrations +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace MyApp.Data.Migrations {{ - public partial class {migrationName} : Migration + /// + public partial class MyMigration : Migration {{ + /// protected override void Up(MigrationBuilder migrationBuilder) {{ migrationBuilder.CreateTable( - name: ""{nameof(ConvertedTestModels)}"", + name: ""ConvertedTestModels"", columns: table => new {{ Id = table.Column(type: ""int"", nullable: false), - HierarchyId = table.Column<{nameof(HierarchyId)}>(type: ""hierarchyid"", nullable: true), + HierarchyId = table.Column(type: ""hierarchyid"", nullable: true), Name = table.Column(type: ""nvarchar(max)"", nullable: true) }}, constraints: table => @@ -52,15 +56,15 @@ protected override void Up(MigrationBuilder migrationBuilder) }}); migrationBuilder.CreateTable( - name: ""{nameof(TestModels)}"", + name: ""TestModels"", columns: table => new {{ - {nameof(Patriarch.Id)} = table.Column<{nameof(HierarchyId)}>(type: ""hierarchyid"", nullable: false), - {nameof(Patriarch.Name)} = table.Column(type: ""nvarchar(max)"", nullable: true) + Id = table.Column(type: ""hierarchyid"", nullable: false), + Name = table.Column(type: ""nvarchar(max)"", nullable: true) }}, constraints: table => {{ - table.PrimaryKey(""PK_{nameof(TestModels)}"", x => x.{nameof(Patriarch.Id)}); + table.PrimaryKey(""PK_TestModels"", x => x.Id); }}); migrationBuilder.InsertData( @@ -84,13 +88,14 @@ protected override void Up(MigrationBuilder migrationBuilder) }}); }} + /// protected override void Down(MigrationBuilder migrationBuilder) {{ migrationBuilder.DropTable( name: ""ConvertedTestModels""); migrationBuilder.DropTable( - name: ""{nameof(TestModels)}""); + name: ""TestModels""); }} }} }} diff --git a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs index fe7bfb9..34b25be 100644 --- a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs +++ b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs @@ -32,35 +32,39 @@ public override string GetExpectedMigrationCode(string migrationName, string roo #nullable disable -namespace {rootNamespace}.Migrations +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace MyApp.Data.Migrations {{ - public partial class {migrationName} : Migration + /// + public partial class MyMigration : Migration {{ + /// protected override void Up(MigrationBuilder migrationBuilder) {{ migrationBuilder.CreateTable( - name: ""{nameof(ConvertedTestModels)}"", + name: ""ConvertedTestModels"", columns: table => new {{ - {nameof(ConvertedPatriarch.Id)} = table.Column(type: ""int"", nullable: false), - {nameof(ConvertedPatriarch.HierarchyId)} = table.Column<{nameof(HierarchyId)}>(type: ""hierarchyid"", nullable: true), - {nameof(ConvertedPatriarch.Name)} = table.Column(type: ""nvarchar(max)"", nullable: true) + Id = table.Column(type: ""int"", nullable: false), + HierarchyId = table.Column(type: ""hierarchyid"", nullable: true), + Name = table.Column(type: ""nvarchar(max)"", nullable: true) }}, constraints: table => {{ - table.PrimaryKey(""PK_{nameof(ConvertedTestModels)}"", x => x.{nameof(ConvertedPatriarch.Id)}); + table.PrimaryKey(""PK_ConvertedTestModels"", x => x.Id); }}); migrationBuilder.CreateTable( - name: ""{nameof(TestModels)}"", + name: ""TestModels"", columns: table => new {{ - {nameof(Patriarch.Id)} = table.Column<{nameof(HierarchyId)}>(type: ""hierarchyid"", nullable: false), - {nameof(Patriarch.Name)} = table.Column(type: ""nvarchar(max)"", nullable: true) + Id = table.Column(type: ""hierarchyid"", nullable: false), + Name = table.Column(type: ""nvarchar(max)"", nullable: true) }}, constraints: table => {{ - table.PrimaryKey(""PK_{nameof(TestModels)}"", x => x.{nameof(Patriarch.Id)}); + table.PrimaryKey(""PK_TestModels"", x => x.Id); }}); migrationBuilder.InsertData( @@ -68,9 +72,9 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] {{ ""Id"", ""HierarchyId"", ""Name"" }}, values: new object[,] {{ - {{ 1, {typeof(HierarchyId).FullName}.Parse(""/""), ""Eddard Stark"" }}, - {{ 2, {typeof(HierarchyId).FullName}.Parse(""/1/""), ""Robb Stark"" }}, - {{ 3, {typeof(HierarchyId).FullName}.Parse(""/2/""), ""Jon Snow"" }} + {{ 1, Microsoft.EntityFrameworkCore.HierarchyId.Parse(""/""), ""Eddard Stark"" }}, + {{ 2, Microsoft.EntityFrameworkCore.HierarchyId.Parse(""/1/""), ""Robb Stark"" }}, + {{ 3, Microsoft.EntityFrameworkCore.HierarchyId.Parse(""/2/""), ""Jon Snow"" }} }}); migrationBuilder.InsertData( @@ -78,19 +82,20 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] {{ ""Id"", ""Name"" }}, values: new object[,] {{ - {{ {typeof(HierarchyId).FullName}.Parse(""/""), ""Eddard Stark"" }}, - {{ {typeof(HierarchyId).FullName}.Parse(""/1/""), ""Robb Stark"" }}, - {{ {typeof(HierarchyId).FullName}.Parse(""/2/""), ""Jon Snow"" }} + {{ Microsoft.EntityFrameworkCore.HierarchyId.Parse(""/""), ""Eddard Stark"" }}, + {{ Microsoft.EntityFrameworkCore.HierarchyId.Parse(""/1/""), ""Robb Stark"" }}, + {{ Microsoft.EntityFrameworkCore.HierarchyId.Parse(""/2/""), ""Jon Snow"" }} }}); }} + /// protected override void Down(MigrationBuilder migrationBuilder) {{ migrationBuilder.DropTable( name: ""ConvertedTestModels""); migrationBuilder.DropTable( - name: ""{nameof(TestModels)}""); + name: ""TestModels""); }} }} }} diff --git a/EFCore.SqlServer.HierarchyId.Test/Test/Utilities/FakeScaffoldingModelFactory.cs b/EFCore.SqlServer.HierarchyId.Test/Test/Utilities/FakeScaffoldingModelFactory.cs index ce6b476..f37edcc 100644 --- a/EFCore.SqlServer.HierarchyId.Test/Test/Utilities/FakeScaffoldingModelFactory.cs +++ b/EFCore.SqlServer.HierarchyId.Test/Test/Utilities/FakeScaffoldingModelFactory.cs @@ -25,7 +25,7 @@ public FakeScaffoldingModelFactory( LoggingDefinitions loggingDefinitions, IModelRuntimeInitializer modelRuntimeInitializer) : base(reporter, candidateNamingService, pluralizer, cSharpUtilities, scaffoldingTypeMapper, - loggingDefinitions, modelRuntimeInitializer) + modelRuntimeInitializer) { } diff --git a/EFCore.SqlServer.HierarchyId.Test/Test/Utilities/SqlServerTestHelpers.cs b/EFCore.SqlServer.HierarchyId.Test/Test/Utilities/SqlServerTestHelpers.cs index eec25e2..492c759 100644 --- a/EFCore.SqlServer.HierarchyId.Test/Test/Utilities/SqlServerTestHelpers.cs +++ b/EFCore.SqlServer.HierarchyId.Test/Test/Utilities/SqlServerTestHelpers.cs @@ -18,8 +18,12 @@ private SqlServerTestHelpers() public override IServiceCollection AddProviderServices(IServiceCollection services) => services.AddEntityFrameworkSqlServer(); - public override void UseProviderOptions(DbContextOptionsBuilder optionsBuilder) - => optionsBuilder.UseSqlServer(new SqlConnection("Database=DummyDatabase")); + public override DbContextOptionsBuilder UseProviderOptions(DbContextOptionsBuilder optionsBuilder) + { + return optionsBuilder.UseSqlServer(new SqlConnection("Database=DummyDatabase")); + } + //public override void UseProviderOptions(DbContextOptionsBuilder optionsBuilder) + // => optionsBuilder.UseSqlServer(new SqlConnection("Database=DummyDatabase")); public override LoggingDefinitions LoggingDefinitions { get; } = new SqlServerLoggingDefinitions(); } From 9a631f2456d35c29036a735f1808262f0268251f Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Tue, 27 Sep 2022 22:19:26 +0330 Subject: [PATCH 04/21] Update Nuget package Version --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index d500d52..b7cd827 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -7,7 +7,7 @@ © 2022 Brice Lambson, et al. All rights reserved. true $(MSBuildThisFileDirectory)key.snk - 3.0.1 + 3.0.2 strict latest MIT From 40655033a07e215470def7459790533875997958 Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Tue, 27 Sep 2022 22:54:51 +0330 Subject: [PATCH 05/21] change version --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index b7cd827..6495e04 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -7,7 +7,7 @@ © 2022 Brice Lambson, et al. All rights reserved. true $(MSBuildThisFileDirectory)key.snk - 3.0.2 + 4.0.0-rc.1 strict latest MIT From 1a35682dc6c341b0fcc21c8d6a570fb035b8452b Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Sat, 12 Nov 2022 22:57:01 +0330 Subject: [PATCH 06/21] Fix Migration --- .../Test/Models/Migrations/AnonymousArraySeedContext.cs | 3 +++ .../Test/Models/Migrations/TypedArraySeedContext.cs | 1 + 2 files changed, 4 insertions(+) diff --git a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs index 7430511..8834217 100644 --- a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs +++ b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs @@ -32,8 +32,11 @@ public override string GetExpectedMigrationCode(string migrationName, string roo #nullable disable +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + namespace {rootNamespace}.Migrations {{ + /// public partial class {migrationName} : Migration {{ /// diff --git a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs index 2d07385..0178261 100644 --- a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs +++ b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs @@ -36,6 +36,7 @@ public override string GetExpectedMigrationCode(string migrationName, string roo namespace {rootNamespace}.Migrations {{ + /// public partial class {migrationName} : Migration {{ /// From 23fdad075559a070d3d551d8303221024df73e54 Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Sun, 13 Nov 2022 20:07:01 +0330 Subject: [PATCH 07/21] Fix Package that not working with EF7.0 --- .../EFCore.InMemory.HierarchyId.Test.csproj | 2 +- .../EFCore.InMemory.HierarchyId.csproj | 2 +- ....SqlServer.HierarchyId.Abstractions.csproj | 2 +- .../EFCore.SqlServer.HierarchyId.Test.csproj | 22 ++++++--- .../RelationalScaffoldingModelFactoryTest.cs | 2 +- .../EFCore.SqlServer.HierarchyId.csproj | 4 +- ...rameworkCore.SqlServer.HierarchyId.targets | 46 +++++++++++++++++++ 7 files changed, 68 insertions(+), 12 deletions(-) create mode 100644 EFCore.SqlServer.HierarchyId/build/net7.0/EntityFrameworkCore.SqlServer.HierarchyId.targets diff --git a/EFCore.InMemory.HierarchyId.Test/EFCore.InMemory.HierarchyId.Test.csproj b/EFCore.InMemory.HierarchyId.Test/EFCore.InMemory.HierarchyId.Test.csproj index 1c11b29..0416c46 100644 --- a/EFCore.InMemory.HierarchyId.Test/EFCore.InMemory.HierarchyId.Test.csproj +++ b/EFCore.InMemory.HierarchyId.Test/EFCore.InMemory.HierarchyId.Test.csproj @@ -8,7 +8,7 @@ - + diff --git a/EFCore.InMemory.HierarchyId/EFCore.InMemory.HierarchyId.csproj b/EFCore.InMemory.HierarchyId/EFCore.InMemory.HierarchyId.csproj index 1937207..7f5d54e 100644 --- a/EFCore.InMemory.HierarchyId/EFCore.InMemory.HierarchyId.csproj +++ b/EFCore.InMemory.HierarchyId/EFCore.InMemory.HierarchyId.csproj @@ -12,7 +12,7 @@ - + diff --git a/EFCore.SqlServer.HierarchyId.Abstractions/EFCore.SqlServer.HierarchyId.Abstractions.csproj b/EFCore.SqlServer.HierarchyId.Abstractions/EFCore.SqlServer.HierarchyId.Abstractions.csproj index ae4835d..ce1fa63 100644 --- a/EFCore.SqlServer.HierarchyId.Abstractions/EFCore.SqlServer.HierarchyId.Abstractions.csproj +++ b/EFCore.SqlServer.HierarchyId.Abstractions/EFCore.SqlServer.HierarchyId.Abstractions.csproj @@ -10,7 +10,7 @@ - + diff --git a/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj b/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj index db680c1..f895d1b 100644 --- a/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj +++ b/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj @@ -1,4 +1,4 @@ - + net7.0 @@ -8,11 +8,15 @@ - - - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + @@ -21,4 +25,10 @@ + + + C:\Users\action\.nuget\packages\microsoft.entityframeworkcore.design\7.0.0\lib\net6.0\Microsoft.EntityFrameworkCore.Design.dll + + + diff --git a/EFCore.SqlServer.HierarchyId.Test/RelationalScaffoldingModelFactoryTest.cs b/EFCore.SqlServer.HierarchyId.Test/RelationalScaffoldingModelFactoryTest.cs index 987d686..da9d2ff 100644 --- a/EFCore.SqlServer.HierarchyId.Test/RelationalScaffoldingModelFactoryTest.cs +++ b/EFCore.SqlServer.HierarchyId.Test/RelationalScaffoldingModelFactoryTest.cs @@ -12,7 +12,7 @@ namespace Microsoft.EntityFrameworkCore.SqlServer; public class RelationalScaffoldingModelFactoryTest { - private readonly IScaffoldingModelFactory _factory; + private readonly Microsoft.EntityFrameworkCore.Scaffolding.IScaffoldingModelFactory _factory; private readonly TestOperationReporter _reporter; private static readonly DatabaseModel Database; diff --git a/EFCore.SqlServer.HierarchyId/EFCore.SqlServer.HierarchyId.csproj b/EFCore.SqlServer.HierarchyId/EFCore.SqlServer.HierarchyId.csproj index 9bb3f70..d318c25 100644 --- a/EFCore.SqlServer.HierarchyId/EFCore.SqlServer.HierarchyId.csproj +++ b/EFCore.SqlServer.HierarchyId/EFCore.SqlServer.HierarchyId.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 EntityFrameworkCore.SqlServer.HierarchyId Microsoft.EntityFrameworkCore.SqlServer Adds hierarchyid support to the SQL Server EF Core provider @@ -17,7 +17,7 @@ - + diff --git a/EFCore.SqlServer.HierarchyId/build/net7.0/EntityFrameworkCore.SqlServer.HierarchyId.targets b/EFCore.SqlServer.HierarchyId/build/net7.0/EntityFrameworkCore.SqlServer.HierarchyId.targets new file mode 100644 index 0000000..09f8c90 --- /dev/null +++ b/EFCore.SqlServer.HierarchyId/build/net7.0/EntityFrameworkCore.SqlServer.HierarchyId.targets @@ -0,0 +1,46 @@ + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + $(IntermediateOutputPath)EFCoreSqlServerHierarchyId$(DefaultLanguageSourceExtension) + + + + + + + CompileBefore + + + + + CompileAfter + + + + + + + Compile + + + + + + + <_Parameter1>Microsoft.EntityFrameworkCore.SqlServer.Design.SqlServerHierarchyIdDesignTimeServices, EntityFrameworkCore.SqlServer.HierarchyId + <_Parameter2>Microsoft.EntityFrameworkCore.SqlServer + + + + + + + + \ No newline at end of file From 2e0ff21d67b07678ee1ed77100a55703860e7ab9 Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Sun, 13 Nov 2022 20:12:33 +0330 Subject: [PATCH 08/21] Fix version --- .github/workflows/dotnet.yml | 2 +- Directory.Build.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index bf40590..4029d81 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -18,7 +18,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v2 with: - dotnet-version: 7.0.100-rc.1.22431.12 + dotnet-version: 7.0.0 - name: Restore dependencies run: dotnet restore - name: Build diff --git a/Directory.Build.props b/Directory.Build.props index 6495e04..7fa8f30 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -7,7 +7,7 @@ © 2022 Brice Lambson, et al. All rights reserved. true $(MSBuildThisFileDirectory)key.snk - 4.0.0-rc.1 + 4.0.0 strict latest MIT From 02c5b55df90c4ec387adce4a63ae79347f3864b5 Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Sun, 13 Nov 2022 21:46:52 +0330 Subject: [PATCH 09/21] use offical version of Microsoft.SqlServer.Types --- .../EFCore.SqlServer.HierarchyId.Abstractions.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EFCore.SqlServer.HierarchyId.Abstractions/EFCore.SqlServer.HierarchyId.Abstractions.csproj b/EFCore.SqlServer.HierarchyId.Abstractions/EFCore.SqlServer.HierarchyId.Abstractions.csproj index ce1fa63..86e4816 100644 --- a/EFCore.SqlServer.HierarchyId.Abstractions/EFCore.SqlServer.HierarchyId.Abstractions.csproj +++ b/EFCore.SqlServer.HierarchyId.Abstractions/EFCore.SqlServer.HierarchyId.Abstractions.csproj @@ -10,7 +10,7 @@ - + From 713c616a55f5e56521f1ffc3f97101d278726709 Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Sun, 13 Nov 2022 21:49:03 +0330 Subject: [PATCH 10/21] change target to net 6.0 --- .../EFCore.SqlServer.HierarchyId.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EFCore.SqlServer.HierarchyId/EFCore.SqlServer.HierarchyId.csproj b/EFCore.SqlServer.HierarchyId/EFCore.SqlServer.HierarchyId.csproj index d318c25..5fe2734 100644 --- a/EFCore.SqlServer.HierarchyId/EFCore.SqlServer.HierarchyId.csproj +++ b/EFCore.SqlServer.HierarchyId/EFCore.SqlServer.HierarchyId.csproj @@ -1,7 +1,7 @@  - net7.0 + net6.0 EntityFrameworkCore.SqlServer.HierarchyId Microsoft.EntityFrameworkCore.SqlServer Adds hierarchyid support to the SQL Server EF Core provider From 4698de959fa4506b8eb373d6a140e30f51490059 Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Sun, 13 Nov 2022 21:50:51 +0330 Subject: [PATCH 11/21] Fix build --- ...rameworkCore.SqlServer.HierarchyId.targets | 46 ------------------- 1 file changed, 46 deletions(-) delete mode 100644 EFCore.SqlServer.HierarchyId/build/net7.0/EntityFrameworkCore.SqlServer.HierarchyId.targets diff --git a/EFCore.SqlServer.HierarchyId/build/net7.0/EntityFrameworkCore.SqlServer.HierarchyId.targets b/EFCore.SqlServer.HierarchyId/build/net7.0/EntityFrameworkCore.SqlServer.HierarchyId.targets deleted file mode 100644 index 09f8c90..0000000 --- a/EFCore.SqlServer.HierarchyId/build/net7.0/EntityFrameworkCore.SqlServer.HierarchyId.targets +++ /dev/null @@ -1,46 +0,0 @@ - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - $(IntermediateOutputPath)EFCoreSqlServerHierarchyId$(DefaultLanguageSourceExtension) - - - - - - - CompileBefore - - - - - CompileAfter - - - - - - - Compile - - - - - - - <_Parameter1>Microsoft.EntityFrameworkCore.SqlServer.Design.SqlServerHierarchyIdDesignTimeServices, EntityFrameworkCore.SqlServer.HierarchyId - <_Parameter2>Microsoft.EntityFrameworkCore.SqlServer - - - - - - - - \ No newline at end of file From 1a05affe016f40f0dc6c00e7fd05a081d405f23e Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Sun, 13 Nov 2022 21:55:58 +0330 Subject: [PATCH 12/21] fix build --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 4029d81..46eca08 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -18,7 +18,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v2 with: - dotnet-version: 7.0.0 + dotnet-version: 6.0.0 - name: Restore dependencies run: dotnet restore - name: Build From 72ca23c21bba20f3f2f5db2bc1e88bdf17e49ab8 Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Sun, 13 Nov 2022 22:00:32 +0330 Subject: [PATCH 13/21] Set dotnet-version: 7.0.0 --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 46eca08..4029d81 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -18,7 +18,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v2 with: - dotnet-version: 6.0.0 + dotnet-version: 7.0.0 - name: Restore dependencies run: dotnet restore - name: Build From 74f035b9c81d4864224c22161f4d19213d3e06a0 Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Sun, 13 Nov 2022 22:03:43 +0330 Subject: [PATCH 14/21] revert 7.0.100-rc.1.22431.12 --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 4029d81..bf40590 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -18,7 +18,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v2 with: - dotnet-version: 7.0.0 + dotnet-version: 7.0.100-rc.1.22431.12 - name: Restore dependencies run: dotnet restore - name: Build From 2c85719a3a44159185a501a00b96dd666b0d95d8 Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Sun, 13 Nov 2022 22:11:19 +0330 Subject: [PATCH 15/21] Fix Tests --- .../EFCore.SqlServer.HierarchyId.Test.csproj | 8 -------- 1 file changed, 8 deletions(-) diff --git a/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj b/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj index f0fe6ae..09d06a6 100644 --- a/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj +++ b/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj @@ -10,8 +10,6 @@ - all - runtime; build; native; contentfiles; analyzers; buildtransitive @@ -25,10 +23,4 @@ - - - C:\Users\action\.nuget\packages\microsoft.entityframeworkcore.design\7.0.0\lib\net6.0\Microsoft.EntityFrameworkCore.Design.dll - - - From 6bb6fe7958f3f16b672a2a68a540c5c48cabd1fe Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Tue, 15 Nov 2022 10:35:27 +0330 Subject: [PATCH 16/21] Fix Version --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index bf40590..d776f57 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -18,7 +18,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v2 with: - dotnet-version: 7.0.100-rc.1.22431.12 + dotnet-version: 7.0.100-rc.2.22477.23 - name: Restore dependencies run: dotnet restore - name: Build From 2b9542ebdb8c10347daa42eee1c0a1fefe00cf3d Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Tue, 15 Nov 2022 12:54:26 +0330 Subject: [PATCH 17/21] add suggestions --- .../EFCore.SqlServer.HierarchyId.Test.csproj | 37 +++++++++---------- .../RelationalScaffoldingModelFactoryTest.cs | 2 +- .../Migrations/AnonymousArraySeedContext.cs | 2 +- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj b/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj index 09d06a6..7f7e0fd 100644 --- a/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj +++ b/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj @@ -1,26 +1,25 @@  - - net7.0 - false - EntityFrameworkCore.SqlServer.HierarchyId.Test - Microsoft.EntityFrameworkCore.SqlServer - + + net7.0 + false + EntityFrameworkCore.SqlServer.HierarchyId.Test + Microsoft.EntityFrameworkCore.SqlServer + - - - - - - - + + + + + + - - - + + + - - - + + + diff --git a/EFCore.SqlServer.HierarchyId.Test/RelationalScaffoldingModelFactoryTest.cs b/EFCore.SqlServer.HierarchyId.Test/RelationalScaffoldingModelFactoryTest.cs index da9d2ff..987d686 100644 --- a/EFCore.SqlServer.HierarchyId.Test/RelationalScaffoldingModelFactoryTest.cs +++ b/EFCore.SqlServer.HierarchyId.Test/RelationalScaffoldingModelFactoryTest.cs @@ -12,7 +12,7 @@ namespace Microsoft.EntityFrameworkCore.SqlServer; public class RelationalScaffoldingModelFactoryTest { - private readonly Microsoft.EntityFrameworkCore.Scaffolding.IScaffoldingModelFactory _factory; + private readonly IScaffoldingModelFactory _factory; private readonly TestOperationReporter _reporter; private static readonly DatabaseModel Database; diff --git a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs index 8834217..2206fba 100644 --- a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs +++ b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs @@ -43,7 +43,7 @@ public partial class {migrationName} : Migration protected override void Up(MigrationBuilder migrationBuilder) {{ migrationBuilder.CreateTable( - name: ""ConvertedTestModels"", + name: ""{nameof(ConvertedTestModels)}"", columns: table => new {{ Id = table.Column(type: ""int"", nullable: false), From 74ea3284752b8355742c0d47451a0ead5115e7a3 Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Tue, 15 Nov 2022 13:09:05 +0330 Subject: [PATCH 18/21] use naming convention --- .../Migrations/TypedArraySeedContext.cs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs index 0178261..1060fc4 100644 --- a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs +++ b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs @@ -43,28 +43,28 @@ public partial class {migrationName} : Migration protected override void Up(MigrationBuilder migrationBuilder) {{ migrationBuilder.CreateTable( - name: ""ConvertedTestModels"", + name: ""{nameof(ConvertedTestModels)}"", columns: table => new {{ - Id = table.Column(type: ""int"", nullable: false), - HierarchyId = table.Column(type: ""hierarchyid"", nullable: true), - Name = table.Column(type: ""nvarchar(max)"", nullable: true) + {nameof(ConvertedPatriarch.Id)} = table.Column(type: ""int"", nullable: false), + {nameof(ConvertedPatriarch.HierarchyId)} = table.Column(type: ""hierarchyid"", nullable: true), + {nameof(ConvertedPatriarch.Name)} = table.Column(type: ""nvarchar(max)"", nullable: true) }}, constraints: table => {{ - table.PrimaryKey(""PK_ConvertedTestModels"", x => x.Id); + table.PrimaryKey(""PK_{nameof(ConvertedTestModels)}"", x => x.{nameof(ConvertedPatriarch.Id)}); }}); migrationBuilder.CreateTable( - name: ""TestModels"", + name: ""{nameof(TestModels)}"", columns: table => new {{ - Id = table.Column(type: ""hierarchyid"", nullable: false), - Name = table.Column(type: ""nvarchar(max)"", nullable: true) + {nameof(Patriarch.Id)} = table.Column(type: ""hierarchyid"", nullable: false), + {nameof(Patriarch.Name)} = table.Column(type: ""nvarchar(max)"", nullable: true) }}, constraints: table => {{ - table.PrimaryKey(""PK_TestModels"", x => x.Id); + table.PrimaryKey(""PK_{nameof(TestModels)}"", x => x.{nameof(Patriarch.Id)}); }}); migrationBuilder.InsertData( @@ -72,9 +72,9 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] {{ ""Id"", ""HierarchyId"", ""Name"" }}, values: new object[,] {{ - {{ 1, Microsoft.EntityFrameworkCore.HierarchyId.Parse(""/""), ""Eddard Stark"" }}, - {{ 2, Microsoft.EntityFrameworkCore.HierarchyId.Parse(""/1/""), ""Robb Stark"" }}, - {{ 3, Microsoft.EntityFrameworkCore.HierarchyId.Parse(""/2/""), ""Jon Snow"" }} + {{ 1, {typeof(HierarchyId).FullName}.Parse(""/""), ""Eddard Stark"" }}, + {{ 2, {typeof(HierarchyId).FullName}.Parse(""/1/""), ""Robb Stark"" }}, + {{ 3, {typeof(HierarchyId).FullName}.Parse(""/2/""), ""Jon Snow"" }} }}); migrationBuilder.InsertData( @@ -82,9 +82,9 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] {{ ""Id"", ""Name"" }}, values: new object[,] {{ - {{ Microsoft.EntityFrameworkCore.HierarchyId.Parse(""/""), ""Eddard Stark"" }}, - {{ Microsoft.EntityFrameworkCore.HierarchyId.Parse(""/1/""), ""Robb Stark"" }}, - {{ Microsoft.EntityFrameworkCore.HierarchyId.Parse(""/2/""), ""Jon Snow"" }} + {{ {typeof(HierarchyId).FullName}.Parse(""/""), ""Eddard Stark"" }}, + {{ {typeof(HierarchyId).FullName}.Parse(""/1/""), ""Robb Stark"" }}, + {{ {typeof(HierarchyId).FullName}.Parse(""/2/""), ""Jon Snow"" }} }}); }} @@ -95,7 +95,7 @@ protected override void Down(MigrationBuilder migrationBuilder) name: ""ConvertedTestModels""); migrationBuilder.DropTable( - name: ""TestModels""); + name: ""{nameof(TestModels)}""); }} }} }} From 88c546820446346303f1efd9bfe95751f503121a Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Tue, 15 Nov 2022 13:21:08 +0330 Subject: [PATCH 19/21] Fix Idents --- .../EFCore.InMemory.HierarchyId.csproj | 1 - ....SqlServer.HierarchyId.Abstractions.csproj | 22 +++++++++---------- .../EFCore.SqlServer.HierarchyId.Test.csproj | 5 +---- .../Migrations/TypedArraySeedContext.cs | 2 +- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/EFCore.InMemory.HierarchyId/EFCore.InMemory.HierarchyId.csproj b/EFCore.InMemory.HierarchyId/EFCore.InMemory.HierarchyId.csproj index cf98768..7f5d54e 100644 --- a/EFCore.InMemory.HierarchyId/EFCore.InMemory.HierarchyId.csproj +++ b/EFCore.InMemory.HierarchyId/EFCore.InMemory.HierarchyId.csproj @@ -13,7 +13,6 @@ - diff --git a/EFCore.SqlServer.HierarchyId.Abstractions/EFCore.SqlServer.HierarchyId.Abstractions.csproj b/EFCore.SqlServer.HierarchyId.Abstractions/EFCore.SqlServer.HierarchyId.Abstractions.csproj index 86e4816..b30389b 100644 --- a/EFCore.SqlServer.HierarchyId.Abstractions/EFCore.SqlServer.HierarchyId.Abstractions.csproj +++ b/EFCore.SqlServer.HierarchyId.Abstractions/EFCore.SqlServer.HierarchyId.Abstractions.csproj @@ -1,16 +1,16 @@ - - netstandard2.0 - EntityFrameworkCore.SqlServer.HierarchyId.Abstractions - Microsoft.EntityFrameworkCore - Common abstractions for using hierarchyid with EF Core - true - true - + + netstandard2.0 + EntityFrameworkCore.SqlServer.HierarchyId.Abstractions + Microsoft.EntityFrameworkCore + Common abstractions for using hierarchyid with EF Core + true + true + - - - + + + diff --git a/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj b/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj index 7f7e0fd..3c5b20f 100644 --- a/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj +++ b/EFCore.SqlServer.HierarchyId.Test/EFCore.SqlServer.HierarchyId.Test.csproj @@ -1,5 +1,4 @@  - net7.0 false @@ -13,7 +12,6 @@ - @@ -21,5 +19,4 @@ - - + \ No newline at end of file diff --git a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs index 1060fc4..2cb8a9a 100644 --- a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs +++ b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs @@ -47,7 +47,7 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new {{ {nameof(ConvertedPatriarch.Id)} = table.Column(type: ""int"", nullable: false), - {nameof(ConvertedPatriarch.HierarchyId)} = table.Column(type: ""hierarchyid"", nullable: true), + {nameof(ConvertedPatriarch.HierarchyId)} = table.Column<{nameof(HierarchyId)}>(type: ""hierarchyid"", nullable: true), {nameof(ConvertedPatriarch.Name)} = table.Column(type: ""nvarchar(max)"", nullable: true) }}, constraints: table => From 5d4aa640162397d42d46e8d56edc436e6de483ca Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Tue, 15 Nov 2022 13:24:51 +0330 Subject: [PATCH 20/21] Resolve unneeded changes --- .../Models/Migrations/AnonymousArraySeedContext.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs index 2206fba..b448b23 100644 --- a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs +++ b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/AnonymousArraySeedContext.cs @@ -47,7 +47,7 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new {{ Id = table.Column(type: ""int"", nullable: false), - HierarchyId = table.Column(type: ""hierarchyid"", nullable: true), + HierarchyId = table.Column<{nameof(HierarchyId)}>(type: ""hierarchyid"", nullable: true), Name = table.Column(type: ""nvarchar(max)"", nullable: true) }}, constraints: table => @@ -56,15 +56,15 @@ protected override void Up(MigrationBuilder migrationBuilder) }}); migrationBuilder.CreateTable( - name: ""TestModels"", + name: ""{nameof(TestModels)}"", columns: table => new {{ - Id = table.Column(type: ""hierarchyid"", nullable: false), - Name = table.Column(type: ""nvarchar(max)"", nullable: true) + {nameof(Patriarch.Id)} = table.Column<{nameof(HierarchyId)}>(type: ""hierarchyid"", nullable: false), + {nameof(Patriarch.Name)} = table.Column(type: ""nvarchar(max)"", nullable: true) }}, constraints: table => {{ - table.PrimaryKey(""PK_TestModels"", x => x.Id); + table.PrimaryKey(""PK_{nameof(TestModels)}"", x => x.{nameof(Patriarch.Id)}); }}); migrationBuilder.InsertData( @@ -95,7 +95,7 @@ protected override void Down(MigrationBuilder migrationBuilder) name: ""ConvertedTestModels""); migrationBuilder.DropTable( - name: ""TestModels""); + name: ""{nameof(TestModels)}""); }} }} }} From 091ccff422aef2ee85e73f86a5cf44442e7ef27e Mon Sep 17 00:00:00 2001 From: Mehdi Haghshenas Date: Tue, 15 Nov 2022 13:27:25 +0330 Subject: [PATCH 21/21] add {nameof(HierarchyId)} --- .../Test/Models/Migrations/TypedArraySeedContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs index 2cb8a9a..6b04e71 100644 --- a/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs +++ b/EFCore.SqlServer.HierarchyId.Test/Test/Models/Migrations/TypedArraySeedContext.cs @@ -59,7 +59,7 @@ protected override void Up(MigrationBuilder migrationBuilder) name: ""{nameof(TestModels)}"", columns: table => new {{ - {nameof(Patriarch.Id)} = table.Column(type: ""hierarchyid"", nullable: false), + {nameof(Patriarch.Id)} = table.Column<{nameof(HierarchyId)}>(type: ""hierarchyid"", nullable: false), {nameof(Patriarch.Name)} = table.Column(type: ""nvarchar(max)"", nullable: true) }}, constraints: table =>