-
Notifications
You must be signed in to change notification settings - Fork 0
/
PluralsightUserDbContext.cs
65 lines (44 loc) · 2.06 KB
/
PluralsightUserDbContext.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace PluralsightDemo
{
public class PluralsightUserDbContext : IdentityDbContext<PluralsightUser>
{
// public DbSet<pendingstudent> UserLogt { get; set; }
public PluralsightUserDbContext(DbContextOptions<PluralsightUserDbContext> options) : base(options)
{
}
//public DbSet<pendingobject> PendingTable { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
//builder.Entity<Notitie>()
// .WithMany(a => a.Notifications)
// .HasForeignKey(n => n.ApplicationUserId)
// .WillCascadeOnDelete(false);
builder.Entity<PluralsightUser>()
.HasMany(x => x.Notities)
.WithOne(y => y.User).HasForeignKey(x=>x.UserId)
.IsRequired();
//builder.Entity<Notitie>(notitie =>
//{
// notitie.ToTable("Notities");
// notitie.HasKey(x => x.Id);
// notitie.HasOne<PluralsightUser>().WithMany().HasPrincipalKey(x => x.NotititieId).IsRequired(false);
//});
//builder.Entity<pendingobject>(pending => {
// pending.ToTable("Pendingobjects");
// pending.HasKey(x=>x.ID);
//});
//builder.Entity<pendingobject>(user => user.HasIndex(x => x.anothervairalbe).IsUnique(false));
//builder.Entity<pendingobject>(user => user.HasIndex(x => x.weerietsanders).IsUnique(false));
//builder.Entity<PluralsightUser>(user => user.HasIndex(x => x.Locale).IsUnique(false));
//builder.Entity<Organization>(org =>
//{
// org.ToTable("Organizations");
// org.HasKey(x => x.Id);
// org.HasMany<PluralsightUser>().WithOne().HasForeignKey(x => x.OrgId).IsRequired(false);
//});
}
}
}