Assume the following table structure:
Tables:
**Tasks**
taskID int PK
taskName varchar
**Resources**
resourceID int PK
resourceName varchar
**Assignments**
assignmentID int PK
taskID int FK
resourceID int FK
The assignments table relates a task with the resource that is assigned to it. Is it possible to map this structure with the model builder so that I do not have to create an Assignment poco class - hiding some of the underlying data structure?
I.E.:
public class Task
{
public int taskID { get; set; }
public string taskName { get; set; }
public virtual ICollection<Resource> resourceItems { get; set; }
}
public class Resource
{
public int resourceID { get; set; }
public string resourceName { get; set; }
}
How can I use the model builder to map tasks to resources without creating an assignment poco class?