From 3988f3b0bab04fb6f3e3bdd7067550f18b11cdca Mon Sep 17 00:00:00 2001
From: Javier Calvarro Nelson <jacalvar@microsoft.com>
Date: Mon, 15 Apr 2019 12:24:28 +0200
Subject: [PATCH] Make Identity UI sample work (#9288)

---
 .../.config/dotnet-tools.json                 | 12 +++++
 ...11154115_CreateIdentitySchema.Designer.cs} | 51 ++++++++++---------
 ...=> 20190411154115_CreateIdentitySchema.cs} |  1 -
 .../ApplicationDbContextModelSnapshot.cs      | 50 +++++++++---------
 .../IdentitySample.DefaultUI.csproj           |  4 ++
 .../Properties/launchSettings.json            | 25 ---------
 6 files changed, 71 insertions(+), 72 deletions(-)
 create mode 100644 src/Identity/samples/IdentitySample.DefaultUI/.config/dotnet-tools.json
 rename src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/{20180126174859_CreateIdentitySchema.Designer.cs => 20190411154115_CreateIdentitySchema.Designer.cs} (83%)
 rename src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/{20180126174859_CreateIdentitySchema.cs => 20190411154115_CreateIdentitySchema.cs} (99%)
 delete mode 100644 src/Identity/samples/IdentitySample.DefaultUI/Properties/launchSettings.json

diff --git a/src/Identity/samples/IdentitySample.DefaultUI/.config/dotnet-tools.json b/src/Identity/samples/IdentitySample.DefaultUI/.config/dotnet-tools.json
new file mode 100644
index 00000000000..f6a8270a15d
--- /dev/null
+++ b/src/Identity/samples/IdentitySample.DefaultUI/.config/dotnet-tools.json
@@ -0,0 +1,12 @@
+{
+  "version": 1,
+  "isRoot": true,
+  "tools": {
+    "dotnet-ef": {
+      "version": "3.0.0-preview3.19153.1",
+      "commands": [
+        "dotnet-ef"
+      ]
+    }
+  }
+}
\ No newline at end of file
diff --git a/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20180126174859_CreateIdentitySchema.Designer.cs b/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20190411154115_CreateIdentitySchema.Designer.cs
similarity index 83%
rename from src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20180126174859_CreateIdentitySchema.Designer.cs
rename to src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20190411154115_CreateIdentitySchema.Designer.cs
index acee5cb362c..b12796dd795 100644
--- a/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20180126174859_CreateIdentitySchema.Designer.cs
+++ b/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20190411154115_CreateIdentitySchema.Designer.cs
@@ -4,28 +4,26 @@ using IdentitySample.DefaultUI.Data;
 using Microsoft.EntityFrameworkCore;
 using Microsoft.EntityFrameworkCore.Infrastructure;
 using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Metadata.Internal;
 using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage;
-using Microsoft.EntityFrameworkCore.Storage.Internal;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 
 namespace IdentitySample.DefaultUI.Data.Migrations
 {
     [DbContext(typeof(ApplicationDbContext))]
-    [Migration("20180126174859_CreateIdentitySchema")]
+    [Migration("20190411154115_CreateIdentitySchema")]
     partial class CreateIdentitySchema
     {
         protected override void BuildTargetModel(ModelBuilder modelBuilder)
         {
 #pragma warning disable 612, 618
             modelBuilder
-                .HasAnnotation("ProductVersion", "2.1.0-preview1-28153")
+                .HasAnnotation("ProductVersion", "3.0.0-preview5.19209.2")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128)
                 .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
 
             modelBuilder.Entity("IdentitySample.DefaultUI.Data.ApplicationUser", b =>
                 {
-                    b.Property<string>("Id")
-                        .ValueGeneratedOnAdd();
+                    b.Property<string>("Id");
 
                     b.Property<int>("AccessFailedCount");
 
@@ -79,8 +77,7 @@ namespace IdentitySample.DefaultUI.Data.Migrations
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
                 {
-                    b.Property<string>("Id")
-                        .ValueGeneratedOnAdd();
+                    b.Property<string>("Id");
 
                     b.Property<string>("ConcurrencyStamp")
                         .IsConcurrencyToken();
@@ -104,7 +101,8 @@ namespace IdentitySample.DefaultUI.Data.Migrations
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                 {
                     b.Property<int>("Id")
-                        .ValueGeneratedOnAdd();
+                        .ValueGeneratedOnAdd()
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
 
                     b.Property<string>("ClaimType");
 
@@ -123,7 +121,8 @@ namespace IdentitySample.DefaultUI.Data.Migrations
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                 {
                     b.Property<int>("Id")
-                        .ValueGeneratedOnAdd();
+                        .ValueGeneratedOnAdd()
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
 
                     b.Property<string>("ClaimType");
 
@@ -191,47 +190,53 @@ namespace IdentitySample.DefaultUI.Data.Migrations
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                 {
-                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
+                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
                         .WithMany()
                         .HasForeignKey("RoleId")
-                        .OnDelete(DeleteBehavior.Cascade);
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
                 });
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                 {
-                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser")
+                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade);
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
                 });
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
                 {
-                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser")
+                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade);
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
                 });
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
                 {
-                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
+                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
                         .WithMany()
                         .HasForeignKey("RoleId")
-                        .OnDelete(DeleteBehavior.Cascade);
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
 
-                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser")
+                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade);
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
                 });
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
                 {
-                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser")
+                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade);
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
                 });
 #pragma warning restore 612, 618
         }
diff --git a/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20180126174859_CreateIdentitySchema.cs b/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20190411154115_CreateIdentitySchema.cs
similarity index 99%
rename from src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20180126174859_CreateIdentitySchema.cs
rename to src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20190411154115_CreateIdentitySchema.cs
index 713e581f6de..091387a0a5e 100644
--- a/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20180126174859_CreateIdentitySchema.cs
+++ b/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20190411154115_CreateIdentitySchema.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Collections.Generic;
 using Microsoft.EntityFrameworkCore.Metadata;
 using Microsoft.EntityFrameworkCore.Migrations;
 
diff --git a/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/ApplicationDbContextModelSnapshot.cs
index 8eb1302cd76..1e0f6ee68ee 100644
--- a/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/ApplicationDbContextModelSnapshot.cs
+++ b/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/ApplicationDbContextModelSnapshot.cs
@@ -4,10 +4,7 @@ using IdentitySample.DefaultUI.Data;
 using Microsoft.EntityFrameworkCore;
 using Microsoft.EntityFrameworkCore.Infrastructure;
 using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Metadata.Internal;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage;
-using Microsoft.EntityFrameworkCore.Storage.Internal;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 
 namespace IdentitySample.DefaultUI.Data.Migrations
 {
@@ -18,13 +15,13 @@ namespace IdentitySample.DefaultUI.Data.Migrations
         {
 #pragma warning disable 612, 618
             modelBuilder
-                .HasAnnotation("ProductVersion", "2.1.0-preview1-28153")
+                .HasAnnotation("ProductVersion", "3.0.0-preview5.19209.2")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128)
                 .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
 
             modelBuilder.Entity("IdentitySample.DefaultUI.Data.ApplicationUser", b =>
                 {
-                    b.Property<string>("Id")
-                        .ValueGeneratedOnAdd();
+                    b.Property<string>("Id");
 
                     b.Property<int>("AccessFailedCount");
 
@@ -78,8 +75,7 @@ namespace IdentitySample.DefaultUI.Data.Migrations
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
                 {
-                    b.Property<string>("Id")
-                        .ValueGeneratedOnAdd();
+                    b.Property<string>("Id");
 
                     b.Property<string>("ConcurrencyStamp")
                         .IsConcurrencyToken();
@@ -103,7 +99,8 @@ namespace IdentitySample.DefaultUI.Data.Migrations
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                 {
                     b.Property<int>("Id")
-                        .ValueGeneratedOnAdd();
+                        .ValueGeneratedOnAdd()
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
 
                     b.Property<string>("ClaimType");
 
@@ -122,7 +119,8 @@ namespace IdentitySample.DefaultUI.Data.Migrations
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                 {
                     b.Property<int>("Id")
-                        .ValueGeneratedOnAdd();
+                        .ValueGeneratedOnAdd()
+                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
 
                     b.Property<string>("ClaimType");
 
@@ -190,47 +188,53 @@ namespace IdentitySample.DefaultUI.Data.Migrations
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                 {
-                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
+                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
                         .WithMany()
                         .HasForeignKey("RoleId")
-                        .OnDelete(DeleteBehavior.Cascade);
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
                 });
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                 {
-                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser")
+                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade);
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
                 });
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
                 {
-                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser")
+                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade);
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
                 });
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
                 {
-                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
+                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
                         .WithMany()
                         .HasForeignKey("RoleId")
-                        .OnDelete(DeleteBehavior.Cascade);
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
 
-                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser")
+                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade);
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
                 });
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
                 {
-                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser")
+                    b.HasOne("IdentitySample.DefaultUI.Data.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade);
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
                 });
 #pragma warning restore 612, 618
         }
diff --git a/src/Identity/samples/IdentitySample.DefaultUI/IdentitySample.DefaultUI.csproj b/src/Identity/samples/IdentitySample.DefaultUI/IdentitySample.DefaultUI.csproj
index 29d2a556c03..843fc867394 100644
--- a/src/Identity/samples/IdentitySample.DefaultUI/IdentitySample.DefaultUI.csproj
+++ b/src/Identity/samples/IdentitySample.DefaultUI/IdentitySample.DefaultUI.csproj
@@ -31,4 +31,8 @@
     <Reference Include="Microsoft.Extensions.Logging.Debug" />
   </ItemGroup>
 
+  <ItemGroup>
+    <Folder Include="Properties\" />
+  </ItemGroup>
+
 </Project>
diff --git a/src/Identity/samples/IdentitySample.DefaultUI/Properties/launchSettings.json b/src/Identity/samples/IdentitySample.DefaultUI/Properties/launchSettings.json
deleted file mode 100644
index 96ae426d0dc..00000000000
--- a/src/Identity/samples/IdentitySample.DefaultUI/Properties/launchSettings.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
-  "iisSettings": {
-    "windowsAuthentication": false,
-    "anonymousAuthentication": true,
-    "iisExpress": {
-      "applicationUrl": "http://localhost:54840/",
-      "sslPort": 0
-    }
-  },
-  "profiles": {
-    "IIS Express": {
-      "commandName": "IISExpress",
-      "launchBrowser": true,
-      "environmentVariables": {
-        "ASPNETCORE_ENVIRONMENT": "Development"
-      }
-    },
-    "web": {
-      "commandName": "web",
-      "environmentVariables": {
-        "ASPNET_ENVIRONMENT": "Development"
-      }
-    }
-  }
-}
\ No newline at end of file
-- 
GitLab