小编hen*_*nas的帖子

BlazorWebAssembly GetFromJsonAsync 未序列化子集合

问题是,为什么当我使用 HttClient .GetFromJsonAsync 从客户端调用 api 时,实体没有子集合?我从浏览器调用 api,JSON 文本有集合,但在对象上没有。

\n

这是我的实体的代码:

\n
using 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)

c# .net-core blazor blazor-webassembly

0
推荐指数
1
解决办法
1074
查看次数

标签 统计

.net-core ×1

blazor ×1

blazor-webassembly ×1

c# ×1