Last active
May 16, 2023 16:43
-
-
Save conwid/fd3eeca89be84610f98fa6a3bc6185d1 to your computer and use it in GitHub Desktop.
Data model extensions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The first demo shows how to extend the user information stored in the database. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApplicationUser : IdentityUser | |
{ | |
public DateTime DateOfBirth { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApplicationDbContext : IdentityDbContext<ApplicationUser> | |
{ | |
public ApplicationDbContext(DbContextOptions options) : base(options) | |
{ | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
builder.Services.AddDbContext<ApplicationDbContext>(opts => opts.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=IdentityDemo;Integrated Security=true")); | |
builder.Services.AddIdentity<ApplicationUser, IdentityRole>(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment