Update Microsoft.DotNet.Web.ProjectTemplates.2.0 contents from dotnet/templating

This commit is contained in:
Steve Sanderson 2017-09-11 15:42:06 +01:00
parent 692faf10ac
commit 414cfde099
3 changed files with 95 additions and 84 deletions

View File

@ -12,8 +12,6 @@ namespace Company.WebApplication1.Pages.Account.Manage
{ {
public class TwoFactorAuthenticationModel : PageModel public class TwoFactorAuthenticationModel : PageModel
{ {
private const string AuthenicatorUriFormat = "otpauth://totp/{0}:{1}?secret={2}&issuer={0}";
private readonly UserManager<ApplicationUser> _userManager; private readonly UserManager<ApplicationUser> _userManager;
private readonly SignInManager<ApplicationUser> _signInManager; private readonly SignInManager<ApplicationUser> _signInManager;
private readonly ILogger<TwoFactorAuthenticationModel> _logger; private readonly ILogger<TwoFactorAuthenticationModel> _logger;
@ -50,4 +48,4 @@ namespace Company.WebApplication1.Pages.Account.Manage
return Page(); return Page();
} }
} }
} }

View File

@ -17,17 +17,85 @@ namespace Company.WebApplication1.Data.Migrations
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618
modelBuilder modelBuilder
#if (UseLocalDB) #if (UseLocalDB)
.HasAnnotation("ProductVersion", "1.0.0-rc3") .HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
#else #else
.HasAnnotation("ProductVersion", "1.0.2"); .HasAnnotation("ProductVersion", "2.0.0-rtm-26452");
#endif #endif
modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
#if (UseLocalDB)
.HasAnnotation("MaxLength", 256);
#else
.HasMaxLength(256);
#endif
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
#if (UseLocalDB)
.HasAnnotation("MaxLength", 256);
#else
.HasMaxLength(256);
#endif
b.Property<string>("NormalizedUserName")
#if (UseLocalDB)
.HasAnnotation("MaxLength", 256);
#else
.HasMaxLength(256);
#endif
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("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 => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{ {
b.Property<string>("Id"); b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken();
@ -49,6 +117,7 @@ namespace Company.WebApplication1.Data.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("NormalizedName") b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex"); .HasName("RoleNameIndex");
b.ToTable("AspNetRoles"); b.ToTable("AspNetRoles");
@ -120,8 +189,6 @@ namespace Company.WebApplication1.Data.Migrations
b.HasIndex("RoleId"); b.HasIndex("RoleId");
b.HasIndex("UserId");
b.ToTable("AspNetUserRoles"); b.ToTable("AspNetUserRoles");
}); });
@ -140,75 +207,10 @@ namespace Company.WebApplication1.Data.Migrations
b.ToTable("AspNetUserTokens"); b.ToTable("AspNetUserTokens");
}); });
modelBuilder.Entity("Company.WebApplication1.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
#if (UseLocalDB)
.HasAnnotation("MaxLength", 256);
#else
.HasMaxLength(256);
#endif
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
#if (UseLocalDB)
.HasAnnotation("MaxLength", 256);
#else
.HasMaxLength(256);
#endif
b.Property<string>("NormalizedUserName")
#if (UseLocalDB)
.HasAnnotation("MaxLength", 256);
#else
.HasMaxLength(256);
#endif
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("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<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{ {
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany("Claims") .WithMany()
.HasForeignKey("RoleId") .HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
@ -216,7 +218,7 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{ {
b.HasOne("Company.WebApplication1.Models.ApplicationUser") b.HasOne("Company.WebApplication1.Models.ApplicationUser")
.WithMany("Claims") .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
@ -224,7 +226,7 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.HasOne("Company.WebApplication1.Models.ApplicationUser") b.HasOne("Company.WebApplication1.Models.ApplicationUser")
.WithMany("Logins") .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
@ -232,15 +234,24 @@ namespace Company.WebApplication1.Data.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{ {
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany("Users") .WithMany()
.HasForeignKey("RoleId") .HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.HasOne("Company.WebApplication1.Models.ApplicationUser") b.HasOne("Company.WebApplication1.Models.ApplicationUser")
.WithMany("Roles") .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Company.WebApplication1.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
} }
} }
} }

View File

@ -39,6 +39,12 @@ namespace Company.WebApplication1.Data.Migrations
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); 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( migrationBuilder.CreateTable(
@ -163,7 +169,8 @@ namespace Company.WebApplication1.Data.Migrations
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "RoleNameIndex", name: "RoleNameIndex",
table: "AspNetRoles", table: "AspNetRoles",
column: "NormalizedName"); column: "NormalizedName",
unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId", name: "IX_AspNetRoleClaims_RoleId",
@ -185,11 +192,6 @@ namespace Company.WebApplication1.Data.Migrations
table: "AspNetUserRoles", table: "AspNetUserRoles",
column: "RoleId"); column: "RoleId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserRoles_UserId",
table: "AspNetUserRoles",
column: "UserId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "EmailIndex", name: "EmailIndex",
table: "AspNetUsers", table: "AspNetUsers",