我返回了一个 Json(myObj) 操作结果。myObj 是 Badge 类型
Badge 仅有的两个可能导致序列化程序循环的对象是:
public class Badge
{
public Badge() { }
public Badge(String Name, String Description)
{
this.Name = Name;
this.Description = Description;
}
[ScriptIgnore]
public virtual BadgeType BadgeType { get; set; }
[ScriptIgnore]
public virtual ICollection<User> Users { get; set; }
public int ID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string PrerequisiteCriteriaRef { get; set; }
//PrerequisiteID
public static Badge CreateForSeeder(BaseDBContext db, String Name, String Description, int TypeID)
{
Badge b = new Badge();
b.Name = Name;
b.Description = Description;
b.BadgeType = db.BadgeTypes.Where(x => x.TypeID == TypeID).FirstOrDefault();
return b;
}
}
我赋予了哪个属性,但它根本没有帮助......?