From 3f55a42741cf00f43ae9e4cb52ee9ddd6bf88564 Mon Sep 17 00:00:00 2001 From: maliming Date: Sun, 16 Oct 2022 09:58:13 +0800 Subject: [PATCH 1/4] Update Data-Seeding.md Resolve #14316 --- docs/en/Data-Seeding.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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. From e2427814f5c32ee80f9e7efb18be6907ecb07fc8 Mon Sep 17 00:00:00 2001 From: Hamza Albreem <94292623+braim23@users.noreply.github.com> Date: Thu, 20 Oct 2022 11:30:17 +0300 Subject: [PATCH 2/4] Tiny typo fix --- docs/en/Data-Seeding.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Data-Seeding.md b/docs/en/Data-Seeding.md index 1806942c1e..0667b0f224 100644 --- a/docs/en/Data-Seeding.md +++ b/docs/en/Data-Seeding.md @@ -131,7 +131,7 @@ 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 +### Separate Units Of Work 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. From 12bd5660e8cfe178b540293294ab538b75e9140d Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 3 Nov 2022 08:27:59 +0800 Subject: [PATCH 3/4] Update docs/en/Data-Seeding.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Halil İbrahim Kalkan --- docs/en/Data-Seeding.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Data-Seeding.md b/docs/en/Data-Seeding.md index 0667b0f224..1806942c1e 100644 --- a/docs/en/Data-Seeding.md +++ b/docs/en/Data-Seeding.md @@ -131,7 +131,7 @@ 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 Units Of Work +### 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. From 7a5020f9f1fbd334190cb888f288ed5d3ac9b3b1 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 3 Nov 2022 08:28:04 +0800 Subject: [PATCH 4/4] Update docs/en/Data-Seeding.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Halil İbrahim Kalkan --- docs/en/Data-Seeding.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Data-Seeding.md b/docs/en/Data-Seeding.md index 1806942c1e..011a5bf37a 100644 --- a/docs/en/Data-Seeding.md +++ b/docs/en/Data-Seeding.md @@ -135,7 +135,7 @@ If a module needs to a parameter, it should be declared on the [module documenta 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`. +We provide an extension method of `SeedInSeparateUowAsync` for the `IDataSeeder` service 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)