Relation between entities returns null

Asked

Viewed 57 times

1

I’m having difficulty checking a parameter in a relationship between Historico and Login.

public class Historico {
    public int ID { get; set; }
    public virtual Login login{ get; set; }
    public DateTime inicio { get; set; }
    public DateTime final { get; set; }
}

public abstract class Login
    {
        public int ID { get; set; }
        [Required]
        public string Nome { get; set; }
        private string Senha { get; set; }
    }

Because whenever I query the database, the Login field returns null. I wanted to know what the modification has to be so that I can get returns the login when accessing with the database.

  • I think the [Key] Ids are missing. You are telling the Entityframework what the entities key is?

  • Another point to check is the fact that Login is Abstract. There are, in fact, concrete Login classes to "perform" this relation?

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.