All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 5m25s
60 lines
2.0 KiB
C#
60 lines
2.0 KiB
C#
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using phronCare.API.Models.Security;
|
|
|
|
namespace phronCare.API.Models
|
|
{
|
|
public class phronCareDbContext : IdentityDbContext<ApplicationUser>
|
|
{
|
|
public phronCareDbContext(DbContextOptions<phronCareDbContext> options) : base(options)
|
|
{
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder builder)
|
|
{
|
|
base.OnModelCreating(builder);
|
|
//SeedRoles(builder);
|
|
}
|
|
|
|
private static void SeedRoles(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<IdentityRole>().HasData
|
|
(
|
|
new IdentityRole() { Name = "Administrator", ConcurrencyStamp = DateTime.Today.ToString(), NormalizedName = "administrator" },
|
|
new IdentityRole() { Name = "User", ConcurrencyStamp = DateTime.Today.ToString(), NormalizedName = "user" }
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
//using Microsoft.AspNetCore.Identity;
|
|
//using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
|
//using Microsoft.EntityFrameworkCore;
|
|
|
|
//namespace phronCare.API.Models
|
|
//{
|
|
// public class phronCareDbContext: IdentityDbContext<IdentityUser>
|
|
// {
|
|
// public phronCareDbContext(DbContextOptions<phronCareDbContext> options):base(options)
|
|
// {
|
|
// }
|
|
// protected override void OnModelCreating(ModelBuilder builder)
|
|
// {
|
|
// base.OnModelCreating(builder);
|
|
// //SeedRoles(builder);
|
|
// }
|
|
// private static void SeedRoles(ModelBuilder modelBuilder)
|
|
// {
|
|
// modelBuilder.Entity<IdentityRole>().HasData
|
|
// (
|
|
// new IdentityRole() { Name = "Administrator", ConcurrencyStamp = DateTime.Today.ToString(), NormalizedName = "administrator" },
|
|
// new IdentityRole() { Name = "User", ConcurrencyStamp = DateTime.Today.ToString(), NormalizedName = "user" }
|
|
// );
|
|
// }
|
|
// }
|
|
//}
|