From 414cfde0991ee8b13bb5f30c9959ce3aeabd17db Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 11 Sep 2017 15:42:06 +0100 Subject: [PATCH] Update Microsoft.DotNet.Web.ProjectTemplates.2.0 contents from dotnet/templating --- .../Manage/TwoFactorAuthentication.cshtml.cs | 4 +- ...000000000_CreateIdentitySchema.Designer.cs | 161 ++++++++++-------- .../00000000000000_CreateIdentitySchema.cs | 14 +- 3 files changed, 95 insertions(+), 84 deletions(-) diff --git a/src/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/RazorPagesWeb-CSharp/Pages/Account/Manage/TwoFactorAuthentication.cshtml.cs b/src/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/RazorPagesWeb-CSharp/Pages/Account/Manage/TwoFactorAuthentication.cshtml.cs index bff77be20e..e91c080e1c 100644 --- a/src/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/RazorPagesWeb-CSharp/Pages/Account/Manage/TwoFactorAuthentication.cshtml.cs +++ b/src/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/RazorPagesWeb-CSharp/Pages/Account/Manage/TwoFactorAuthentication.cshtml.cs @@ -12,8 +12,6 @@ namespace Company.WebApplication1.Pages.Account.Manage { public class TwoFactorAuthenticationModel : PageModel { - private const string AuthenicatorUriFormat = "otpauth://totp/{0}:{1}?secret={2}&issuer={0}"; - private readonly UserManager _userManager; private readonly SignInManager _signInManager; private readonly ILogger _logger; @@ -50,4 +48,4 @@ namespace Company.WebApplication1.Pages.Account.Manage return Page(); } } -} \ No newline at end of file +} diff --git a/src/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Data/Migrations/00000000000000_CreateIdentitySchema.Designer.cs b/src/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Data/Migrations/00000000000000_CreateIdentitySchema.Designer.cs index 483520ed85..4ef62fc3d5 100644 --- a/src/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Data/Migrations/00000000000000_CreateIdentitySchema.Designer.cs +++ b/src/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Data/Migrations/00000000000000_CreateIdentitySchema.Designer.cs @@ -17,17 +17,85 @@ namespace Company.WebApplication1.Data.Migrations { protected override void BuildTargetModel(ModelBuilder modelBuilder) { +#pragma warning disable 612, 618 modelBuilder #if (UseLocalDB) - .HasAnnotation("ProductVersion", "1.0.0-rc3") + .HasAnnotation("ProductVersion", "2.0.0-rtm-26452") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); #else - .HasAnnotation("ProductVersion", "1.0.2"); + .HasAnnotation("ProductVersion", "2.0.0-rtm-26452"); #endif + modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("Email") +#if (UseLocalDB) + .HasAnnotation("MaxLength", 256); +#else + .HasMaxLength(256); +#endif + + b.Property("EmailConfirmed"); + + b.Property("LockoutEnabled"); + + b.Property("LockoutEnd"); + + b.Property("NormalizedEmail") +#if (UseLocalDB) + .HasAnnotation("MaxLength", 256); +#else + .HasMaxLength(256); +#endif + + b.Property("NormalizedUserName") +#if (UseLocalDB) + .HasAnnotation("MaxLength", 256); +#else + .HasMaxLength(256); +#endif + + b.Property("PasswordHash"); + + b.Property("PhoneNumber"); + + b.Property("PhoneNumberConfirmed"); + + b.Property("SecurityStamp"); + + b.Property("TwoFactorEnabled"); + + b.Property("UserName") +#if (UseLocalDB) + .HasAnnotation("MaxLength", 256); +#else + .HasMaxLength(256); +#endif + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasName("UserNameIndex"); + + b.ToTable("AspNetUsers"); + }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { - b.Property("Id"); + b.Property("Id") + .ValueGeneratedOnAdd(); b.Property("ConcurrencyStamp") .IsConcurrencyToken(); @@ -49,6 +117,7 @@ namespace Company.WebApplication1.Data.Migrations b.HasKey("Id"); b.HasIndex("NormalizedName") + .IsUnique() .HasName("RoleNameIndex"); b.ToTable("AspNetRoles"); @@ -120,8 +189,6 @@ namespace Company.WebApplication1.Data.Migrations b.HasIndex("RoleId"); - b.HasIndex("UserId"); - b.ToTable("AspNetUserRoles"); }); @@ -140,75 +207,10 @@ namespace Company.WebApplication1.Data.Migrations b.ToTable("AspNetUserTokens"); }); - modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b => - { - b.Property("Id"); - - b.Property("AccessFailedCount"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); - - b.Property("Email") -#if (UseLocalDB) - .HasAnnotation("MaxLength", 256); -#else - .HasMaxLength(256); -#endif - - b.Property("EmailConfirmed"); - - b.Property("LockoutEnabled"); - - b.Property("LockoutEnd"); - - b.Property("NormalizedEmail") -#if (UseLocalDB) - .HasAnnotation("MaxLength", 256); -#else - .HasMaxLength(256); -#endif - - b.Property("NormalizedUserName") -#if (UseLocalDB) - .HasAnnotation("MaxLength", 256); -#else - .HasMaxLength(256); -#endif - - b.Property("PasswordHash"); - - b.Property("PhoneNumber"); - - b.Property("PhoneNumberConfirmed"); - - b.Property("SecurityStamp"); - - b.Property("TwoFactorEnabled"); - - b.Property("UserName") -#if (UseLocalDB) - .HasAnnotation("MaxLength", 256); -#else - .HasMaxLength(256); -#endif - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") - .WithMany("Claims") + .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade); }); @@ -216,7 +218,7 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.HasOne("Company.WebApplication1.Models.ApplicationUser") - .WithMany("Claims") + .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); }); @@ -224,7 +226,7 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.HasOne("Company.WebApplication1.Models.ApplicationUser") - .WithMany("Logins") + .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); }); @@ -232,15 +234,24 @@ namespace Company.WebApplication1.Data.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") - .WithMany("Users") + .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade); b.HasOne("Company.WebApplication1.Models.ApplicationUser") - .WithMany("Roles") + .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Company.WebApplication1.Models.ApplicationUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 } } } diff --git a/src/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Data/Migrations/00000000000000_CreateIdentitySchema.cs b/src/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Data/Migrations/00000000000000_CreateIdentitySchema.cs index 93771c4379..4c606d8ff4 100644 --- a/src/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Data/Migrations/00000000000000_CreateIdentitySchema.cs +++ b/src/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Data/Migrations/00000000000000_CreateIdentitySchema.cs @@ -39,6 +39,12 @@ namespace Company.WebApplication1.Data.Migrations constraints: table => { table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_AspNetUserTokens_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( @@ -163,7 +169,8 @@ namespace Company.WebApplication1.Data.Migrations migrationBuilder.CreateIndex( name: "RoleNameIndex", table: "AspNetRoles", - column: "NormalizedName"); + column: "NormalizedName", + unique: true); migrationBuilder.CreateIndex( name: "IX_AspNetRoleClaims_RoleId", @@ -185,11 +192,6 @@ namespace Company.WebApplication1.Data.Migrations table: "AspNetUserRoles", column: "RoleId"); - migrationBuilder.CreateIndex( - name: "IX_AspNetUserRoles_UserId", - table: "AspNetUserRoles", - column: "UserId"); - migrationBuilder.CreateIndex( name: "EmailIndex", table: "AspNetUsers",