A developer can be affected to 0 or more task. A task needs at least one developer to be executed. How do I express that in Code first?
public class Task
{
public int ID
//more properties here
public virtual ICollection<Developer> Developers { get; set; }
}
public class Developer
{
public int ID
//more properties here
public virtual ICollection<Task> Tasks { get; set; }
}
Thanks for helping
It’s still a regular many-to-many relationship, and it should get mapped correctly by default. Specific business (validation) rules do not change its nature.
You can implement IValidatableObject if you want to enforce specific cardinalities when saving.