aspnetboilerplateef-core-2.2ef-core-3.0asp.net-boilerplate

Get all parent table rows and all children's table rows in ABP .NET core framework


I'm using built-in CRUD operations in ABP .NET Core but when it returned the data from the GetAll method, its retuned all parent rows, but return null in their list of children.

  public class MainProjectAppService : AsyncCrudAppService<MainProject, MainProjectDto, int, PagedAndSortedResultRequestDto, MainProjectDto, MainProjectDto>
    {

 public MainProjectAppService(IRepository<MainProject, int> repositoryr) : base(repository)
        {

        }
}

enter image description here

-------------------------------

My Dto Code

 [AutoMap(typeof(MainProject))]
    public class MainProjectDto:EntityDto<int>
    {
       :
       :
       :

}

Solution

  • I think your problem is not a mapping problem. You should override CreateFilteredQuery of AsyncCrudAppService and include your detail list properties. AsyncCrudAppService GetAll calls this protected method. You can also add your additional linq queries from this method. If you do not include detail relations they are not included resulting actual sql query :

     protected override IQueryable<YourEntity> CreateFilteredQuery(PagedAndSortedResultRequestDto input)
        {
            return base.CreateFilteredQuery(input)
                .Include(p => p.YourDetailListProperty)
                .Include(p => p.YourOtherDetailListProperty)
        }