I have a IdentityDBContext which i would like to join to other entities via EF Core.
Currently i am using the default authentication from the project creation.
I am trying to figure out how i would join the id from the aspnetUsers table into multiple custom tables.
Below URL only explains how to add it to one table, but not many tables.
Entity Framework Core Join identity AspNetUser table. AspNetUser Id to custom tables/Entities
Example:
public class Inventory
{
public int ID { get; set; }
public string ItemName { get; set; }
public int amountQuantity { get; set; }
public DateTime UpdateDate { get; set; }
-- userid from aspnetuserid
}
public class TestModel
{
public int id { get; set; }
public string mysex { get; set; }
-- userid from aspnetuserid
}
public class WorkOutItems
{
public int Id { get; set; }
public string ItemName { get; set; }
public int CountOfItemName { get; set; }
-- userid from aspnetuserid
}
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
public DbSet<Inventory> Inventory { get; set; } -- this to have aspnetuserid
public DbSet<TestModel> TestModels { get; set; }-- this to have aspnetuserid
public DbSet<WorkOutItems> WorkOutItems { get; set; }-- this to have aspnetuserid
}