From 8f9ef8389e67640b8601b917727e9f97617e2a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 12 Jun 2020 11:04:03 +0300 Subject: [PATCH] Resolved #4298: Database BLOB provider can configure the default container if not configured before --- docs/en/Blob-Storing-Database.md | 2 ++ .../Database/BlobStoringDatabaseDomainModule.cs | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/en/Blob-Storing-Database.md b/docs/en/Blob-Storing-Database.md index b413882227..69b9232ee8 100644 --- a/docs/en/Blob-Storing-Database.md +++ b/docs/en/Blob-Storing-Database.md @@ -55,6 +55,8 @@ If you want to use a separate database for BLOB storage, use the `AbpBlobStoring ### Configuring the Containers +If you are using only the database storage provider, you don't need to manually configure it, since it is automatically done. If you are using multiple storage providers, you may want to configure it. + Configuration is done in the `ConfigureServices` method of your [module](Module-Development-Basics.md) class, as explained in the [BLOB Storing document](Blob-Storing.md). **Example: Configure to use the database storage provider by default** diff --git a/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain/Volo/Abp/BlobStoring/Database/BlobStoringDatabaseDomainModule.cs b/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain/Volo/Abp/BlobStoring/Database/BlobStoringDatabaseDomainModule.cs index e49f9ce63b..316659af67 100644 --- a/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain/Volo/Abp/BlobStoring/Database/BlobStoringDatabaseDomainModule.cs +++ b/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain/Volo/Abp/BlobStoring/Database/BlobStoringDatabaseDomainModule.cs @@ -10,6 +10,18 @@ namespace Volo.Abp.BlobStoring.Database )] public class BlobStoringDatabaseDomainModule : AbpModule { - + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.Containers.ConfigureDefault(container => + { + if (container.ProviderType == null) + { + container.UseDatabase(); + } + }); + }); + } } }