你的位置:首页 > ASP.net教程

[ASP.net教程]EF查询 linq


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> BlogArt{get;set;}}

查询ID=1

SchoolContext Db=new SchoolContext();List<Student> list=Db.Student.ToList();list.where(a => a.ID== 1)