I'm using entity framework core. I want to have 3 tables: Appoitments, Users and Roles. The 'Users' table contains application members with different roles. Is there a way to have 'Appoitments' table with foreign keys: ClientID and ConsultantID of type 'User'?
public class ApplicationUser : IdentityUser
{
public List<Appointment> Appointments { get; set; }
}
public class Appointment
{
public int AppointmentId {get;set;}
public DateTime Date { get; set; }
public int RoomNumber { get; set; }
public ApplicationUser ConsultantId { get; set; }
public ApplicationUser ClientId { get; set; }
}
I created classes ApplicationUser and Appointment and in ApplicationDbContext i added property: public DbSet Appointments { get; set; }.
But when I tried to add migration, Packet Manager threw "(Unable to determine the relationship represented by navigation property 'ApplicationUser.Appointments' of type 'List'.