Abstracting some details I have these classes:
public class Department: Entitie
{
public string Description { get; private set; }
public DateTime CreateDate { get; private set; }
public virtual ICollection<Service> Services {get; set;}
}
public class Service: Entitie
{
public string Description { get; set; }
public Guid DepartmentId { get; set; }
public virtual Department Department { get; set; }
}
public class DepartmentServiceRequest: Entitie
{
public Guid DepartmentId { get; set; }
public virtual Department Department { get; set; }
public virtual ICollection<Service> Services { get; set; }
}
The DepartmentServiceRequest
class is just one of my many attempts to make it work.
A Department provides several Services . A department can request one or more services to another department, and this needs to be previously mapped. That is, he has the services he provides and those he can request. The goal is not to register a Service, it is to map what types it can register.
In the bank the result is this:
I do not understand why he's taking Id from DepartmentServiceRequest
to Service .
Is it possible via mapping to inform that it should generate this associative table only with the IDs of Department
and Service
? This seems logical to me, thinking relationally.