Starts in:
1 DAY
9 HRS
34 MIN
59 SEC
Starts in:
1 D
9 H
34 M
59 S
Open Closed

[POSSIBLE BUG] ABP suite navigation properties with many to many relation returning empty result #3635


User avatar
0
shonimav created

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v6.0.0.rc.2 (Commercial)
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

I have an entity called Stories and it has 2 navigation properties created through ABP Suite. 1 is one to many relationship with Categories and other is many to many relationship with Tags. When I'm making a call to get a list of stories, it returns all values except for Tags and within the repository I found that it assigns empty tag list without any query generated to get tags. What needs to be changed in ABP suite to generate query for tags in below method?

 protected virtual async Task<IQueryable<StoriesWithNavigationProperties>> GetQueryForNavigationPropertiesAsync()
        {
            return from stories in (await GetDbSetAsync())
                   join category in (await GetDbContextAsync()).Categories on stories.CategoryId equals category.Id into categories
                   from category in categories.DefaultIfEmpty()

                   select new StoriesWithNavigationProperties
                   {
                       Stories = stories,
                       Category = category,
                       Tags = new List<Tag>()  // Instead of new List it should have loaded   with tags
                   };
        }

1 Answer(s)
  • User Avatar
    0
    yekalkan created
    Support Team Fullstack Developer

    Hi @shonimavi,

    This is not a bug. Many-to-Many properties are not included in GetList methods. Also they are not presented in the UI datatable.

    You can modify the query to include tags yourserlf, if you need.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06