- ABP Framework version: v3.3.0
Hello,
within my tests I have several DataSeedContributor implementation that inherit from IDataSeedContributor However, some test data seeds needs to be executed before another seed to make valid test data possible (e.g. I like to execute the OrderDataSeedContributor before the OrderItemsDataSeedContributor before since OrderItems are related to Orders).
Now I like to control the exectuion order of the DataSeedContributor. I found that the DataSeeds are executed here
await scope.ServiceProvider
.GetRequiredService<IDataSeeder>()
.SeedAsync();
How can I control the execution order?
Thanks!
3 Answer(s)
-
0
Hi,
Unfortunately the order cannot be determined, You can add dependency injection completely manually, but it is hard work. You'd better initialize the seed data in the same contributor
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Thank you for your reply! What do you mean with "You'd better initialize the seed data in the same contributor"?
Do you mean that I should combine all seed data in the same class/ method?
Thank you
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
(e.g. I like to execute the OrderDataSeedContributor before the OrderItemsDataSeedContributor before since OrderItems are related to Orders).
You can initialize orders and order items in
OrderDataSeedContributorMarkdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)