我如何 return 来自网络 api 的两个实体对象?

How can I return two entity objects from web api?

我想做的是使用 Json 对象从单个 return 获取两个实体和 returning 从而得到这个异常:-

Self referencing loop detected for property 'Job' with type 'System.Data.Entity.DynamicProxies

这是我在代码中所做的

        [Route("api/Listing/GetAllList/{id:Guid}")]
        [HttpGet]
        public ResponseWrapper<GenericResponseModel> GetAllList(Guid id)
        {
            
             var heightSafety = database.HeightSafetyForms.Where(j => j.JobId == id).FirstOrDefault();
            var chimneyTower = database.ChimneyTowerForms.Where(j => j.JobId == id).FirstOrDefault();
            return ResponseService.ReturnResponse(() =>
            {
                if (heightSafety == null || chimneyTower == null)
                {
                 return new GenericResponseModel(false, "Job could not be found.", null);
                }
                else
                {
                    return new GenericResponseModel(true, string.Empty, Json(new
                    {
                        heightSafety = heightSafety,
                        chimneyTower = chimneyTower
                    }));

                }
            }, Request);
        }
    }
}

为 ChimneyTower 和 HieghtSafety 创建了 ModelHelper Class,并将 ChimneyTower 对象的值分配给 ChimneyTowerModelHelper 对象,然后 return 在 return 语句中编辑