I have a DbDataController that provides a list of hardware.
public IQueryable<BettrFit.Models.Equipment> GetEquipment() { var q= DbContext.EquipmentSet.OrderBy(e => e.Name); return q; }
In my subclass, everything looks fine.
But the equipment contains a member of the HashSet EquipmentType. I want to show this type in my view, and also be able to add data to the EquipmentType collection of equipment (through a list of several types).
But if I try to include "EquipmentType" in my linq query , it fails during serialization .
public IQueryable<BettrFit.Models.Equipment> GetEquipment() { var q= DbContext.EquipmentSet.Include("EquipmentType").OrderBy(e => e.Name); return q; }
"The object graph for the EquipmentType type contains loops and cannot be serialized if link tracking is disabled"
How to enable "reverse link tracking"?
Maybe the problem is that EquipmentType supports feedback through a HashSet? But I do not include ("EquipmentType.Equipment") in my request. So it should be good.
How does upshot generate a model? I just found the EquipmentViewModel.js file, but it does not contain any model members.
Here are my model classes:
public class Equipment { public Equipment() { this.Exercise = new HashSet<Exercise>(); this.EquipmentType = new HashSet<EquipmentType>(); this.UserDetails = new HashSet<UserDetails>(); } public int ID { get; set; } public string Name { get; set; } public string Description { get; set; } public string Picture { get; set; } public string Link { get; set; } public string Producer { get; set; } public string Video { get; set; } public virtual ICollection<EquipmentType> EquipmentType { get; set; } public virtual ICollection<UserDetails> UserDetails { get; set; } } public class EquipmentType { public EquipmentType() { this.Equipment = new HashSet<Equipment>(); this.UserDetails = new HashSet<UserDetails>(); } public int ID { get; set; } public string Name { get; set; } public string Description { get; set; } public virtual ICollection<Equipment> Equipment { get; set; } public virtual ICollection<UserDetails> UserDetails { get; set; } }
Obiwan007
source share