//Student.cs
public int Id{get;set;} public string name{get;set;} //SchoolContext.cs public class SchoolContext : DbContext { public SchoolContext() : base("SchoolContext") { } public DbSet<Student> Student { get; set; } } //查询ID=1 SchoolContext Db=new SchoolContext(); List<Student> list=Db.Student.ToList(); list.where(a => a.ID== 1)