1
我引用AbpUser表的實體以下實體定義:外鍵引用對象返回null
[ForeignKey("LocationManagerId")]
public virtual User LocationManager { get; set; }
public virtual long LocationManagerId { get; protected set; }
我的DTO如下:
[AutoMapFrom(typeof(Location))]
public class LocationDto : FullAuditedEntityDto<Guid>
{
<snip>
public virtual User LocationManager { get; set; }
}
使用AsyncCrudAppService並調用以下來自MVC控制器:
var locations = (await _locationAppService.GetAll(new PagedAndSortedResultRequestDto())).Items;
locations.LocationManager is re變爲空。我已經確認了實體中的所有內容,並且將dto設置爲虛擬。我很茫然。任何人有任何見解?
我們什麼都不知道你的代碼。 '_locationAppService.GetAll'做什麼? –
不知道您的Auto Mapper如何使用導航屬性。即使啓用「延遲加載」,您的映射程序也不會調用導航屬性。 –