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
In the assignment table, a task with a resource assigned to it is defined. Is it possible to correlate this structure with the model builder so that I do not have to create the poco Assignment class - hiding part of the basic 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 model builder to map tasks to resources without creating an assignment poco class?
entity-framework data-modeling ef-code-first code-first entity-framework-ctp5
Chris klepeis
source share