我在数据库结构下面有数据,
下面是entity
和dbContext
类,
public class SchoolContext : DbContext
{
public DbSet<Grade> Grades { get; set; }
public DbSet<Student> Students { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(@"Server=(localdb)\MSSQLLocalDB;Database=SchoolDB;Trusted_Connection=True;");
}
}
public class Grade
{
public int Id { get; set; }
public string GradeName { get; set; }
public virtual ICollection<Student> Students { get; set; } = new HashSet<Student>();
}
public class Student
{
public int Id { get; set; }
public string StudentName { get; set; }
}
现在,我正在尝试获取Grade
的{{1}}实体,其GradeId = 1。如何通过GradeId?
Student
答案 0 :(得分:2)
似乎您实际上是在尝试获得ID等于1的成绩并预加载相关数据。因此,您可以尝试以下方法:
CFSocketConnectToAddress(self.socket, sin_cfd, -1)
答案 1 :(得分:0)
一种可能的解决方案:
<meta name="viewport" content="width=device-width, initial-scale=1.0">