BEST
DEALS
OF THE
YEAR!
SAVE UP TO $3,000
24 NOV
1 DEC
00 Days
00 Hrs
00 Min
00 Sec
Open Closed

Dataseeding a Many to Many item not working? #5974


User avatar
0
SuperBeastX3 created

ABP Framework version: v7.3.3 UI Type: MVC Database System: EF Core Tiered (for MVC) or Auth Server Separated (for Angular): tiered

I am trying to dataseed an object with a many to many collection. I create the collection items first, and then try to use those ids on insert of the many to many, but it never actually saves them. The underlying checks SetAssetCategoriesAsync don't see them yet because they are not in the database, so it doesn't pull any to save.

assetCategoryList.Add(await _assetCategoryManager.CreateAsync("Corporate Laptop", "Corporate Laptop", true));
assetCategoryList.Add(await _assetCategoryManager.CreateAsync("Developer Laptop", "Developer Laptop", true));

This next line creates the my asset taxonomy item, but doesn't add the newly created asset categories.

assetTaxonomy = await _assetTaxonomyManager.CreateAsync(assetCategoryList.Select(e => e.Id).ToList(), "Asset Taxonomy", "Asset Taxonomy Description"); ;

In the SetAssetCategoriesAsync (created by abp suite), no categories are found:

var query = (await _assetCategoryRepository.GetQueryableAsync())
    .Where(x => assetCategoryIds.Contains(x.Id))
    .Select(x => x.Id);
var assetCategoryIdsInDb = await AsyncExecuter.ToListAsync(query);
if (!assetCategoryIdsInDb.Any())
{
    return;
}

Please advise, thanks!


6 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    Could you use the abp suite to create a new project to reproduce the problem and share it with me? my email is shiwei.liang@volosoft.com.

    I will check it. thanks.

  • User Avatar
    0
    SuperBeastX3 created

    A zipped sample is 242Mb, I can't email that. Do you have a place I can copy it to?

  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    You can upload to google drive or onedrive and share the link with me.

  • User Avatar
    0
    SuperBeastX3 created

    See if this link works for you: https://1drv.ms/u/s----------------?e=FhNSL1

  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    You need to save change first.

  • User Avatar
    0
    SuperBeastX3 created

    Ah, I see. That worked. Thanks!

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on November 20, 2025, 09:12
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.