问题是,为什么当我使用 HttClient .GetFromJsonAsync 从客户端调用 api 时,实体没有子集合?我从浏览器调用 api,JSON 文本有集合,但在对象上没有。
\n这是我的实体的代码:
\nusing System.Collections.Generic;\nusing System.ComponentModel.DataAnnotations.Schema;\n\nnamespace excelnobleza.shared.Models.Tablas.Produccion\n{\n [Table("Lineas")]\n public class Linea\n {\n public int Id { get; set; }\n public string Nombre { get; set; }\n public string Responsable { get; set; }\n public string EmailResponsable { get; set; }\n public virtual ICollection<Maquina> Maquinas { get; } = new HashSet<Maquina>();\n public override string ToString() => this.Nombre;\n }\n\n public class Maquina\n {\n public int Id { get; set; }\n\n [Required(ErrorMessage = "El nombre …Run Code Online (Sandbox Code Playgroud)