Last active
June 8, 2020 00:59
-
-
Save vpetkovic/f0edc60f4a0b693dddf731f5f1286c7a to your computer and use it in GitHub Desktop.
NETCore 3.1
This file contains 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
using IdentityServer.Model; | |
using Microsoft.AspNetCore.Identity.EntityFrameworkCore; | |
using Microsoft.EntityFrameworkCore; | |
namespace IdentityServer.Data | |
{ | |
public class AppDbContext : IdentityDbContext<ApplicationUser> | |
{ | |
public AppDbContext(DbContextOptions<AppDbContext> options) | |
: base(options) | |
{ | |
} | |
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | |
{ | |
base.OnConfiguring(optionsBuilder); | |
} | |
} | |
} |
This file contains 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
using Microsoft.AspNetCore.Identity; | |
namespace IdentityServer.Model | |
{ | |
public class ApplicationUser : IdentityUser | |
{ | |
public string FirstName { get; set; } | |
public string LastName { get; set; } | |
public bool IsActive { get; set; } | |
} | |
} |
This file contains 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 void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddDbContext<AppDbContext>(config => | |
{ | |
config.UseMySQL(_config.GetConnectionString("Default"), sql => sql | |
.CharSetBehavior(CharSetBehavior.NeverAppend)))); | |
}); | |
services.AddIdentity<ApplicationUser, IdentityRole>(options => options.SignIn.RequireConfirmedAccount = false) | |
.AddEntityFrameworkStores<AppDbContext>() | |
.AddDefaultTokenProviders(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment