mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 13:40:13 +01:00
CreateDatabase
Nic nie działa bo wszystko jest inne XDD
This commit is contained in:
@@ -1,17 +1,37 @@
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApp.Entities;
|
||||
|
||||
namespace WebApp.Data
|
||||
{
|
||||
public class ApplicationDbContext : IdentityDbContext
|
||||
public class ApplicationDbContext : IdentityDbContext<User, IdentityRole<string>, string>
|
||||
{
|
||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public DbSet<Organisation> Organisations => Set<Organisation>();
|
||||
public DbSet<Event> Events => Set<Event>();
|
||||
public DbSet<Skill> Skills => Set<Skill>();
|
||||
public DbSet<VolunteerSkill> VolunteerSkills => Set<VolunteerSkill>();
|
||||
public DbSet<EventSkill> EventSkills => Set<EventSkill>();
|
||||
public DbSet<EventRegistration> EventRegistrations => Set<EventRegistration>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
// Compose keys
|
||||
builder.Entity<VolunteerSkill>()
|
||||
.HasKey(vs => new { vs.UserId, vs.SkillId });
|
||||
|
||||
builder.Entity<EventSkill>()
|
||||
.HasKey(es => new { es.EventId, es.SkillId });
|
||||
|
||||
builder.Entity<EventRegistration>()
|
||||
.HasKey(er => new { er.UserId, er.EventId });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user