2
I have the following problem: A client has tasks for each day of the week.
Example:
Client A - Saturday - Wash Car, Clean House...
Map it as follows:
public class Cliente
{
    [Key]
    public int Id { get; set; }
    [MaxLength(250)]
    public string Nome { get; set; }
    public virtual ICollection<DiaSemana> DiasSemana { get; set; }
}
public class DiaSemana
{
    public DiaSemana()
    {
        Tarefas = new List<Tarefa>();
        Clientes = new List<Cliente>();
    }
    [Key]
    public int Id { get; set; }
    [MaxLength(20)]
    public string Dia { get; set; }
    public virtual ICollection<Tarefa> Tarefas { get; set; }
    public virtual ICollection<Cliente> Clientes { get; set; }
}
public class Tarefa
{
    public Tarefa()
    {
        DiasSemana = new List<DiaSemana>();
    }
    [Key]
    public int Id { get; set; }
    [MaxLength(20)]
    public string Nome { get; set; }
    public virtual ICollection<DiaSemana> DiasSemana { get; set; }
}
When I first started to popular the bank, using the Entity Framework, became a mess and I began to see that the Entity Framework got it all wrong rs (EF donkeys)...
I know the way that Mapeie is incorrect, but I’m not getting how I can be mapping the classes correctly.
Edit:
The RU has created the following tables:
Task
Id          Nome
1           Lavar Louça
2           Limpar Casa       
Taskmaster
Treafa_Id        DiaSemana_Id
1                2
2                2
Days
Id             Dia
1              Segunda
2              Terça
3              Quarta
Daycare
DiaSemana_Id         Cliente_Id
2                    99
2                    66
Client
Id        Nome
99        Diego
66        Felipe
In this case the bank is assuming that Diego and Felipe have both tasks. However Diego Tuesday has only the task of Dishwashing and Felipe only the task of Cleaning House.
In my understanding needed the id client in the table Tarefadiasemana
I didn’t understand your problem. The mapping is correct. What would be wrong?
– Leonel Sanches da Silva
@Gypsy omorrisonmendez I edited the question, it became clearer the problem now.
– Diego Zanardo
Ah, now that I’ve seen it. My lack of attention. I’ll answer.
– Leonel Sanches da Silva