Entity Framework Core Multiple Foreign Keys to the same Entity

50 Views Asked by At

For example I have these 2 Entities

public class Group
{
    public int Id { get; set; }
    public string Name { get; set; }
    public string Email { get; set; }
    public ICollection<EmployeeGroup> EmployeesGroups { get; set; }
}

public class ProcessState
{
    public int Id { get; set; }        
    public string PendingEntity { get; set; }
    public string ApprovingEntity { get; set; }
    public string Message { get; set; }
    public ICollection<Process> Processes { get; set; }
}

I would like to have

PendingEntity
ApprovingEntity 

to be foreign keys to the Group Entity.

int PendingEntity - Group.Id
int ApprovingEntity - Group.Id

How can i describe this on my model?

0

There are 0 best solutions below