Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How can I change default AspNetUserLogins table to MyUserLogins table in Blazor Web App .Net 8, Login with Invidual Account?

$
0
0

When I create a Blazor web app with authentication type = Invidual Account. It automatically maps with default AspNet tables. Can I change the name of these tables to make it maps with my tables in Database.

blazor web app setting image

Asp net default tables image

I tried changing the ApplicationDbContext.cs but it does not work.

public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : IdentityDbContext<ApplicationUser>(options){    protected override void OnModelCreating(ModelBuilder modelBuilder)    {        base.OnModelCreating(modelBuilder);        modelBuilder.Entity<IdentityUser>().ToTable("MyUsers");        modelBuilder.Entity<IdentityRole>().ToTable("MyRoles");        modelBuilder.Entity<IdentityRoleClaim<string>>().ToTable("MyRoleClaims");        modelBuilder.Entity<IdentityUserClaim<string>>().ToTable("MyUserClaims");        modelBuilder.Entity<IdentityUserLogin<string>>().ToTable("MyUserLogins");        modelBuilder.Entity<IdentityUserRole<string>>().ToTable("MyUserRoles");        modelBuilder.Entity<IdentityUserToken<string>>().ToTable("MyUserTokens");    }}

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>