diff --git a/docs/en/Data-Seeding.md b/docs/en/Data-Seeding.md index f3e9414f0f..1806942c1e 100644 --- a/docs/en/Data-Seeding.md +++ b/docs/en/Data-Seeding.md @@ -131,6 +131,16 @@ Then the data seed contributors can access to these properties via the `DataSeed If a module needs to a parameter, it should be declared on the [module documentation](Modules/Index.md). For example, the [Identity Module](Modules/Identity.md) can use `AdminEmail` and `AdminPassword` parameters if you provide (otherwise uses the default values). +### Separate Unit Of Works + +The default seed will be in a unit of work and may use transactions. If there are multiple `IDataSeedContributor` or too much data written, it may cause a database timeout error. + +We provide an extension method of `SeedInSeparateUowAsync` to create a separate unit of work for each `IDataSeedContributor`. + +````csharp +public static Task SeedInSeparateUowAsync(this IDataSeeder seeder, Guid? tenantId = null, AbpUnitOfWorkOptions options = null, bool requiresNew = false) +```` + ### Where & How to Seed Data? It is important to understand where & how to execute the `IDataSeeder.SeedAsync()`? @@ -163,4 +173,4 @@ We suggest the same way on development. Run the DbMigrator console application w You probably want to seed the data also for automated [testing](Testing.md), so want to use the `IDataSeeder.SeedAsync()`. In the [application startup template](Startup-Templates/Application.md), it is done in the [OnApplicationInitialization](Module-Development-Basics.md) method of the *YourProjectName*TestBaseModule class of the TestBase project. -In addition to the standard seed data (that is also used on production), you may want to seed additional data unique to the automated tests. If so, you can create a new data seed contributor in the test project to have more data to work on. \ No newline at end of file +In addition to the standard seed data (that is also used on production), you may want to seed additional data unique to the automated tests. If so, you can create a new data seed contributor in the test project to have more data to work on.