Fixed some APIs that worked mins ago....something strange happening with EF relationships.

This commit is contained in:
Joseph Milazzo 2021-01-19 10:45:37 -06:00
parent 295e62d773
commit 14e8c3b820
10 changed files with 62 additions and 43 deletions

View file

@ -39,6 +39,11 @@ namespace API.Data
.WithOne(u => u.Role)
.HasForeignKey(ur => ur.RoleId)
.IsRequired();
// AppUsers have Libraries, not other way around
builder.Entity<Library>()
.HasMany(p => p.AppUsers)
.WithMany(p => p.Libraries)
.UsingEntity(j => j.ToTable("AppUserLibrary"));
}
void OnEntityTracked(object sender, EntityTrackedEventArgs e)