我得到类似JSON的结果:
我称这个结果为
localhost:53304/api/Students
我想在我的Json结果中看到填充的类,并且我在这里非常了解序列化器设置,这是我的一些类和设置代码:
DbContex:
public partial class MyContext : DbContext
{
public MyContext()
: base("name=MyContext")
{
this.Configuration.ProxyCreationEnabled = false;
this.Configuration.LazyLoadingEnabled = false;
}
Student.cs
[Table("Student")]
public partial class Student
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Student()
{
Discontinuity = new HashSet<Discontinuity>();
Grade = new HashSet<Grade>();
Payment = new HashSet<Payment>();
}
public int Id { get; set; }
[StringLength(50)]
public string Type { get; set; }
public int? Class_Id { get; set; }
public int? Group_Id { get; set; }
[StringLength(11)]
public string TCno { get; set; }
[StringLength(50)]
public string FName { get; set; }
[StringLength(50)]
public string LName { get; set; }
public bool? Gender { get; set; }
public DateTime? Birthday { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Discontinuity> Discontinuity { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Grade> Grade { get; set; }
public virtual Group Group { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Payment> Payment { get; set; }
}
我想在结果的开头看到我当前的班级名称:
“学生”: [ { “ name”:“分子人”, “年龄”:29 ] }
我想在国外课程中查看结果,例如成绩[]