The Entity Framework notation is "very polluted" if you take into account how I am used to defining the Domain classes, I wanted to know if it is correct to have an EF template class to represent the database data and one to represent the domain class.
EF model class example:
User Class
public class UsuarioDominio
{
public string Matricula { get; set; }
public string Nome { get; set; }
public string Login { get; set; }
public virtual List<Atividade> AtividadesResponsavel { get; set; }
}
Class Activity
public class Atividade
{
public int ID { get; set; }
public string Titulo { get; set; }
public string Descricao { get; set; }
public DateTime DataInicio { get; set; }
public string ResponsavelID { get; set; }
public virtual UsuarioDominio Responsavel { get; set; }
public string Status { get; set; }
}
Normally used class example:
User Class
public class UsuarioDominio
{
public string Matricula { get; set; }
public string Nome { get; set; }
public string Login { get; set; }
}
Class Activity
public class Atividade
{
public int ID { get; set; }
public string Titulo { get; set; }
public string Descricao { get; set; }
public DateTime DataInicio { get; set; }
public UsuarioDominio Responsavel { get; set; }
public char Status { get; set; }
}
From what I understood from the EF the class which will be the "template for the table" should have the same properties as the table as FK's (ResponsavelID), for example. In addition to being necessary to add in the other class the virtual List since it has the relationship of 1: N.
I'm still learning and maybe I'm talking nonsense, but what I understand is more or less how it works (I even find it redundant to have the Respondent ID and the virtual Respondent UserName).
The question is, do I use the Domain class as I am accustomed to, use only the EF model or can I use both? Also, is there the possibility of using only the domain and mapping the Map of each class so that it does not pollute the code of the Domain class?