C# 使用UpdateAsync方法从移动服务接收GIG数据
因此,当我在本地部署azure移动服务时,更新操作正在运行。但在我将其发布到Azure之后,我的应用程序在尝试更新数据时崩溃。例如,这里有两类我的:C# 使用UpdateAsync方法从移动服务接收GIG数据,c#,json,entity-framework,azure,azure-mobile-services,C#,Json,Entity Framework,Azure,Azure Mobile Services,因此,当我在本地部署azure移动服务时,更新操作正在运行。但在我将其发布到Azure之后,我的应用程序在尝试更新数据时崩溃。例如,这里有两类我的: public class TestSet : EntityData { public TestSet() { this.TestPointAttempts = new List<TestPointAttempt>(); } [StringLength(10)] public st
public class TestSet : EntityData
{
public TestSet()
{
this.TestPointAttempts = new List<TestPointAttempt>();
}
[StringLength(10)]
public string TestTeamType { get; set; }
public int FieldTeamNumber { get; set; }
public int? DispatchTeamNumber { get; set; }
[DefaultValue(0)]
public int TestSetCount { get; set; }
public string DiscrepancyTypeId { get; set; }
public virtual DiscrepancyType DiscrepancyType { get; set; }
public string DiscrepancyTestSetId { get; set; }
public decimal? BER { get; set; }
public decimal? SSI { get; set; }
public decimal? BERLat { get; set; }
public decimal? BERLong { get; set; }
public string TileId { get; set; }
public virtual Tile Tile { get; set; }
public string ScenarioId { get; set; }
public virtual Scenario Scenario { get; set; }
public virtual ICollection<TestPointAttempt> TestPointAttempts { get; set; }
}
public class TestPointAttempt : EntityData
{
[Required]
public int TestAttemptNumber { get; set; }
public bool? TalkIn { get; set; }
public bool? TalkOut { get; set; }
public decimal? DAQIn { get; set; }
public decimal? DAQOut { get; set; }
public decimal? LatIn { get; set; }
public decimal? LongIn { get; set; }
public decimal? LatOut { get; set; }
public decimal? LongOut { get; set; }
public string TestSetId { get; set; }
public virtual TestSet TestSet { get; set; }
}
然后我用fiddler查看响应,fiddler也会崩溃,因为响应太大。所以现在我发现移动服务的响应是海量数据…但是如何呢?我甚至不知道从哪里开始找。我调试了移动服务,更新似乎通过TableController进行得很好,但它返回了大量数据
我从哪里开始查看移动服务以了解它如何/为什么返回这么多数据?问题在于JSON何时会尝试序列化虚拟集合。由于我的所有导航属性也被序列化,因此试图发回数据库的很大一部分。解决方案是在导航属性上添加json ignore属性,如下所示:
[JsonIgnore]
public virtual Scenario Scenario { get; set; }
[JsonIgnore]
public virtual Scenario Scenario { get; set; }