There is:
public class contextNs :DbContext{ DbSet<User> Users{get;set;} DbSet<Message> Messages{get;set;} } public class User{ public int Id {get;set;} public string Name {get;set;} } public class Message{ public int Id{get;set;} public string text{get;set;} public User User{get;set;} } When passing to the representation of the Message class object, the User property (User = null) disappears from it. When working in the controller, this property is present.
var model = this.Db.Messages.Include(x => x.User).FirstOrDefault(); return this.View(model);var model = this.Db.Messages.Include(x => x.User).FirstOrDefault(); return this.View(model);or work with the database highlighted in the repository? - AK ♦