changes LiebContext, renamed User to LiebUser
This commit is contained in:
parent
bde2735096
commit
7b44e41eb2
12 changed files with 31 additions and 20 deletions
|
@ -12,11 +12,11 @@ namespace Lieb.Data
|
||||||
return; // DB has been seeded
|
return; // DB has been seeded
|
||||||
}
|
}
|
||||||
|
|
||||||
var users = new User[]
|
var users = new LiebUser[]
|
||||||
{
|
{
|
||||||
new User{DiscordUserId=0, Name="Sarah",Birthday=DateTime.Parse("1992-01-15")},
|
new LiebUser{DiscordUserId=0, Name="Sarah",Birthday=DateTime.Parse("1992-01-15")},
|
||||||
new User{DiscordUserId=0, Name="Lisa",Birthday=DateTime.Parse("1991-02-15")},
|
new LiebUser{DiscordUserId=0, Name="Lisa",Birthday=DateTime.Parse("1991-02-15")},
|
||||||
new User{DiscordUserId=0, Name="Simon",Birthday=DateTime.Parse("2019-09-01")}
|
new LiebUser{DiscordUserId=0, Name="Simon",Birthday=DateTime.Parse("2019-09-01")}
|
||||||
};
|
};
|
||||||
|
|
||||||
context.Users.AddRange(users);
|
context.Users.AddRange(users);
|
||||||
|
|
|
@ -6,17 +6,18 @@ using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Lieb.Models;
|
using Lieb.Models;
|
||||||
using Lieb.Models.Raid;
|
using Lieb.Models.Raid;
|
||||||
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace Lieb.Data
|
namespace Lieb.Data
|
||||||
{
|
{
|
||||||
public class LiebContext : DbContext
|
public class LiebContext : IdentityDbContext<LiebUser>
|
||||||
{
|
{
|
||||||
public LiebContext (DbContextOptions<LiebContext> options)
|
public LiebContext (DbContextOptions<LiebContext> options)
|
||||||
: base(options)
|
: base(options)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public DbSet<User> Users { get; set; }
|
public DbSet<LiebUser> Users { get; set; }
|
||||||
public DbSet<GuildWars2Account> GuildWars2Account { get; set; }
|
public DbSet<GuildWars2Account> GuildWars2Account { get; set; }
|
||||||
public DbSet<Equipped> Equipped { get; set; }
|
public DbSet<Equipped> Equipped { get; set; }
|
||||||
public DbSet<RaidRole> RaidRoles { get; set; }
|
public DbSet<RaidRole> RaidRoles { get; set; }
|
||||||
|
@ -31,7 +32,8 @@ namespace Lieb.Data
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
modelBuilder.Entity<User>().ToTable("User");
|
base.OnModelCreating(modelBuilder);
|
||||||
|
modelBuilder.Entity<LiebUser>().ToTable("User");
|
||||||
modelBuilder.Entity<GuildWars2Account>().ToTable("GuildWars2Account");
|
modelBuilder.Entity<GuildWars2Account>().ToTable("GuildWars2Account");
|
||||||
modelBuilder.Entity<Equipped>().ToTable("Equipped");
|
modelBuilder.Entity<Equipped>().ToTable("Equipped");
|
||||||
modelBuilder.Entity<RaidRole>().ToTable("RaidRole");
|
modelBuilder.Entity<RaidRole>().ToTable("RaidRole");
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.2" />
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.2" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.2" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.2" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.2">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
namespace Lieb.Models
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
|
||||||
|
namespace Lieb.Models
|
||||||
{
|
{
|
||||||
public class User
|
public class LiebUser : IdentityUser
|
||||||
{
|
{
|
||||||
public int UserId { get; set; }
|
public int LiebUserId { get; set; }
|
||||||
public ulong DiscordUserId { get; set; }
|
public ulong DiscordUserId { get; set; }
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
public string Pronouns { get; set; } = string.Empty;
|
public string Pronouns { get; set; } = string.Empty;
|
|
@ -21,7 +21,7 @@
|
||||||
public SignUpType SignUpType { get; set; }
|
public SignUpType SignUpType { get; set; }
|
||||||
|
|
||||||
public Raid Raid { get; set; }
|
public Raid Raid { get; set; }
|
||||||
public User User { get; set; } = new User();
|
public LiebUser User { get; set; } = new LiebUser();
|
||||||
public GuildWars2Account GuildWars2Account { get; set; } = new GuildWars2Account();
|
public GuildWars2Account GuildWars2Account { get; set; } = new GuildWars2Account();
|
||||||
public PlannedRaidRole PlannedRaidRole { get; set; } = new PlannedRaidRole();
|
public PlannedRaidRole PlannedRaidRole { get; set; } = new PlannedRaidRole();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
public short Quickness { get; set; }
|
public short Quickness { get; set; }
|
||||||
public short Alacrity { get; set; }
|
public short Alacrity { get; set; }
|
||||||
public short Heal { get; set; }
|
public short Heal { get; set; }
|
||||||
public User Tank { get; set; } = new User();
|
public LiebUser Tank { get; set; } = new LiebUser();
|
||||||
|
|
||||||
public bool RandomClass { get; set; }
|
public bool RandomClass { get; set; }
|
||||||
public bool RandomEliteSpecialization { get; set; }
|
public bool RandomEliteSpecialization { get; set; }
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace Lieb.Pages.Users
|
||||||
}
|
}
|
||||||
|
|
||||||
[BindProperty]
|
[BindProperty]
|
||||||
public User User { get; set; }
|
public LiebUser User { get; set; }
|
||||||
|
|
||||||
// To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
|
// To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
|
||||||
public async Task<IActionResult> OnPostAsync()
|
public async Task<IActionResult> OnPostAsync()
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Lieb.Pages.Users
|
||||||
}
|
}
|
||||||
|
|
||||||
[BindProperty]
|
[BindProperty]
|
||||||
public User User { get; set; }
|
public LiebUser User { get; set; }
|
||||||
|
|
||||||
public async Task<IActionResult> OnGetAsync(int? id)
|
public async Task<IActionResult> OnGetAsync(int? id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace Lieb.Pages.Users
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User User { get; set; }
|
public LiebUser User { get; set; }
|
||||||
|
|
||||||
public async Task<IActionResult> OnGetAsync(int? id)
|
public async Task<IActionResult> OnGetAsync(int? id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace Lieb.Pages.Users
|
||||||
}
|
}
|
||||||
|
|
||||||
[BindProperty]
|
[BindProperty]
|
||||||
public User User { get; set; }
|
public LiebUser User { get; set; }
|
||||||
|
|
||||||
public async Task<IActionResult> OnGetAsync(int? id)
|
public async Task<IActionResult> OnGetAsync(int? id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace Lieb.Pages.Users
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<User> User { get;set; }
|
public IList<LiebUser> User { get;set; }
|
||||||
|
|
||||||
public async Task OnGetAsync()
|
public async Task OnGetAsync()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
using Discord.OAuth2;
|
using Discord.OAuth2;
|
||||||
using Lieb.Data;
|
using Lieb.Data;
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Microsoft.AspNetCore.Components.Web;
|
using Microsoft.AspNetCore.Components.Web;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
@ -13,6 +14,10 @@ builder.Services.AddRazorPages();
|
||||||
|
|
||||||
builder.Services.AddDbContext<LiebContext>(options =>
|
builder.Services.AddDbContext<LiebContext>(options =>
|
||||||
options.UseSqlServer(builder.Configuration.GetConnectionString("LiebContext")));
|
options.UseSqlServer(builder.Configuration.GetConnectionString("LiebContext")));
|
||||||
|
/*
|
||||||
|
builder.Services.AddDefaultIdentity<LiebUser>(options => options.SignIn.RequireConfirmedAccount = true)
|
||||||
|
.AddEntityFrameworkStores<Lieb2Context>();builder.Services.AddDbContext<Lieb2Context>(options =>
|
||||||
|
options.UseSqlServer(connectionString));*/
|
||||||
|
|
||||||
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
|
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue