Given the following scenario. I have 1 user table and 1 login table, for example. I need to create my domain class that maps these DB entities. In the login table, I get the user ID. What does this relationship look like in my model?
[Table("Usuario")]
public class Usuario
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int IdUsuario { get; set; }
public string NMUsuario { get; set; }
public string Senha { get; set; }
}
[Table("Login")]
public class Login
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int IdLogin { get; set; }
public DateTime DtLogin { get; set; }
public virtual ICollection<Usuario> Usuarios { get; set; }?????????
}
Is that what I put in a Collection? And in the user table, just a virtual UserID?