From abd7a798c92cfc61d348496bca9edaee688a8193 Mon Sep 17 00:00:00 2001 From: Fernando Araoz Date: Wed, 15 Jan 2025 19:32:36 -0500 Subject: [PATCH] refactor: migrations for using guid --- ....cs => 20250116002931_Initial.Designer.cs} | 221 ++++++++---------- ...dIdentity.cs => 20250116002931_Initial.cs} | 19 +- .../ApplicationDbContextModelSnapshot.cs | 217 ++++++++--------- Model/ApplicationDbContext.cs | 3 +- Model/User.cs | 3 +- Program.cs | 1 + 6 files changed, 215 insertions(+), 249 deletions(-) rename Migrations/{20250111224853_AddIdentity.Designer.cs => 20250116002931_Initial.Designer.cs} (79%) rename Migrations/{20250111224853_AddIdentity.cs => 20250116002931_Initial.cs} (92%) diff --git a/Migrations/20250111224853_AddIdentity.Designer.cs b/Migrations/20250116002931_Initial.Designer.cs similarity index 79% rename from Migrations/20250111224853_AddIdentity.Designer.cs rename to Migrations/20250116002931_Initial.Designer.cs index c0d7fd8..bcf8221 100644 --- a/Migrations/20250111224853_AddIdentity.Designer.cs +++ b/Migrations/20250116002931_Initial.Designer.cs @@ -12,8 +12,8 @@ using Trazo.Model; namespace Trazo.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("20250111224853_AddIdentity")] - partial class AddIdentity + [Migration("20250116002931_Initial")] + partial class Initial { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -26,10 +26,11 @@ namespace Trazo.Migrations NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { - b.Property("Id") - .HasColumnType("text"); + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() @@ -52,7 +53,7 @@ namespace Trazo.Migrations b.ToTable("AspNetRoles", "identity"); }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -66,9 +67,8 @@ namespace Trazo.Migrations b.Property("ClaimValue") .HasColumnType("text"); - b.Property("RoleId") - .IsRequired() - .HasColumnType("text"); + b.Property("RoleId") + .HasColumnType("uuid"); b.HasKey("Id"); @@ -77,11 +77,91 @@ namespace Trazo.Migrations b.ToTable("AspNetRoleClaims", "identity"); }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { - b.Property("Id") + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") .HasColumnType("text"); + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", "identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", "identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", "identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", "identity"); + }); + + modelBuilder.Entity("Trazo.Model.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + b.Property("AccessFailedCount") .HasColumnType("integer"); @@ -89,11 +169,6 @@ namespace Trazo.Migrations .IsConcurrencyToken() .HasColumnType("text"); - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(13) - .HasColumnType("character varying(13)"); - b.Property("Email") .HasMaxLength(256) .HasColumnType("character varying(256)"); @@ -144,145 +219,53 @@ namespace Trazo.Migrations .HasDatabaseName("UserNameIndex"); b.ToTable("AspNetUsers", "identity"); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("text"); - - b.Property("ClaimValue") - .HasColumnType("text"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", "identity"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("ProviderKey") - .HasColumnType("text"); - - b.Property("ProviderDisplayName") - .HasColumnType("text"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", "identity"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("text"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", "identity"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("Value") - .HasColumnType("text"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", "identity"); - }); - - modelBuilder.Entity("Trazo.Model.User", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.HasDiscriminator().HasValue("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + b.HasOne("Trazo.Model.User", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + b.HasOne("Trazo.Model.User", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + b.HasOne("Trazo.Model.User", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + b.HasOne("Trazo.Model.User", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) diff --git a/Migrations/20250111224853_AddIdentity.cs b/Migrations/20250116002931_Initial.cs similarity index 92% rename from Migrations/20250111224853_AddIdentity.cs rename to Migrations/20250116002931_Initial.cs index 11cfcb9..8bfe330 100644 --- a/Migrations/20250111224853_AddIdentity.cs +++ b/Migrations/20250116002931_Initial.cs @@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace Trazo.Migrations { /// - public partial class AddIdentity : Migration + public partial class Initial : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -20,7 +20,7 @@ namespace Trazo.Migrations schema: "identity", columns: table => new { - Id = table.Column(type: "text", nullable: false), + Id = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), NormalizedName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), ConcurrencyStamp = table.Column(type: "text", nullable: true) @@ -35,8 +35,7 @@ namespace Trazo.Migrations schema: "identity", columns: table => new { - Id = table.Column(type: "text", nullable: false), - Discriminator = table.Column(type: "character varying(13)", maxLength: 13, nullable: false), + Id = table.Column(type: "uuid", nullable: false), UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), NormalizedUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), @@ -64,7 +63,7 @@ namespace Trazo.Migrations { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RoleId = table.Column(type: "text", nullable: false), + RoleId = table.Column(type: "uuid", nullable: false), ClaimType = table.Column(type: "text", nullable: true), ClaimValue = table.Column(type: "text", nullable: true) }, @@ -87,7 +86,7 @@ namespace Trazo.Migrations { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - UserId = table.Column(type: "text", nullable: false), + UserId = table.Column(type: "uuid", nullable: false), ClaimType = table.Column(type: "text", nullable: true), ClaimValue = table.Column(type: "text", nullable: true) }, @@ -111,7 +110,7 @@ namespace Trazo.Migrations LoginProvider = table.Column(type: "text", nullable: false), ProviderKey = table.Column(type: "text", nullable: false), ProviderDisplayName = table.Column(type: "text", nullable: true), - UserId = table.Column(type: "text", nullable: false) + UserId = table.Column(type: "uuid", nullable: false) }, constraints: table => { @@ -130,8 +129,8 @@ namespace Trazo.Migrations schema: "identity", columns: table => new { - UserId = table.Column(type: "text", nullable: false), - RoleId = table.Column(type: "text", nullable: false) + UserId = table.Column(type: "uuid", nullable: false), + RoleId = table.Column(type: "uuid", nullable: false) }, constraints: table => { @@ -157,7 +156,7 @@ namespace Trazo.Migrations schema: "identity", columns: table => new { - UserId = table.Column(type: "text", nullable: false), + UserId = table.Column(type: "uuid", nullable: false), LoginProvider = table.Column(type: "text", nullable: false), Name = table.Column(type: "text", nullable: false), Value = table.Column(type: "text", nullable: true) diff --git a/Migrations/ApplicationDbContextModelSnapshot.cs b/Migrations/ApplicationDbContextModelSnapshot.cs index a35425a..0edb59f 100644 --- a/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Migrations/ApplicationDbContextModelSnapshot.cs @@ -23,10 +23,11 @@ namespace Trazo.Migrations NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { - b.Property("Id") - .HasColumnType("text"); + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() @@ -49,7 +50,7 @@ namespace Trazo.Migrations b.ToTable("AspNetRoles", "identity"); }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -63,9 +64,8 @@ namespace Trazo.Migrations b.Property("ClaimValue") .HasColumnType("text"); - b.Property("RoleId") - .IsRequired() - .HasColumnType("text"); + b.Property("RoleId") + .HasColumnType("uuid"); b.HasKey("Id"); @@ -74,11 +74,91 @@ namespace Trazo.Migrations b.ToTable("AspNetRoleClaims", "identity"); }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { - b.Property("Id") + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") .HasColumnType("text"); + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", "identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", "identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", "identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", "identity"); + }); + + modelBuilder.Entity("Trazo.Model.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + b.Property("AccessFailedCount") .HasColumnType("integer"); @@ -86,11 +166,6 @@ namespace Trazo.Migrations .IsConcurrencyToken() .HasColumnType("text"); - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(13) - .HasColumnType("character varying(13)"); - b.Property("Email") .HasMaxLength(256) .HasColumnType("character varying(256)"); @@ -141,145 +216,53 @@ namespace Trazo.Migrations .HasDatabaseName("UserNameIndex"); b.ToTable("AspNetUsers", "identity"); - - b.HasDiscriminator().HasValue("IdentityUser"); - - b.UseTphMappingStrategy(); }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("text"); - - b.Property("ClaimValue") - .HasColumnType("text"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", "identity"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("ProviderKey") - .HasColumnType("text"); - - b.Property("ProviderDisplayName") - .HasColumnType("text"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", "identity"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("text"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", "identity"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("Value") - .HasColumnType("text"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", "identity"); - }); - - modelBuilder.Entity("Trazo.Model.User", b => - { - b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); - - b.HasDiscriminator().HasValue("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + b.HasOne("Trazo.Model.User", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + b.HasOne("Trazo.Model.User", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + b.HasOne("Trazo.Model.User", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + b.HasOne("Trazo.Model.User", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) diff --git a/Model/ApplicationDbContext.cs b/Model/ApplicationDbContext.cs index 735d050..f8cffa6 100644 --- a/Model/ApplicationDbContext.cs +++ b/Model/ApplicationDbContext.cs @@ -1,9 +1,10 @@ +using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; namespace Trazo.Model; -public class ApplicationDbContext(DbContextOptions options) : IdentityDbContext(options) +public class ApplicationDbContext(DbContextOptions options) : IdentityDbContext, Guid>(options) { protected override void OnModelCreating(ModelBuilder builder) { diff --git a/Model/User.cs b/Model/User.cs index 8800bc6..e8be389 100644 --- a/Model/User.cs +++ b/Model/User.cs @@ -2,5 +2,4 @@ using Microsoft.AspNetCore.Identity; namespace Trazo.Model; -public class User : IdentityUser { } - +public class User : IdentityUser { } diff --git a/Program.cs b/Program.cs index 42da172..e396daa 100644 --- a/Program.cs +++ b/Program.cs @@ -12,6 +12,7 @@ builder.Services.AddAuthorization(); builder.Services.AddAuthentication().AddCookie(IdentityConstants.ApplicationScheme); builder.Services.AddIdentityCore() + .AddRoles>() .AddEntityFrameworkStores() .AddApiEndpoints();