From f176159ae193b7e20b908f2c3902e7fce9a3e856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 11 Jun 2020 14:04:32 +0300 Subject: [PATCH] #4312 Revise the BLOB Storage Azure Provider document. --- docs/en/Blob-Storing-Azure.md | 44 ++++++++++++++--------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/docs/en/Blob-Storing-Azure.md b/docs/en/Blob-Storing-Azure.md index edc0b58a8e..d43f8b3a43 100644 --- a/docs/en/Blob-Storing-Azure.md +++ b/docs/en/Blob-Storing-Azure.md @@ -2,21 +2,19 @@ BLOB Storing Azure Provider can store BLOBs in [Azure Blob storage](https://azure.microsoft.com/en-us/services/storage/blobs/). -> Read the [BLOB Storing document](Blob-Storing.md) to understand how to use the BLOB storing system. This document only covers how to configure containers to use a Azure blob as the storage provider. +> Read the [BLOB Storing document](Blob-Storing.md) to understand how to use the BLOB storing system. This document only covers how to configure containers to use a Azure BLOB as the storage provider. ## Installation -You can use dotnet cli to install [the package](https://www.nuget.org/packages/Volo.Abp.BlobStoring.Azure). +Use the ABP CLI to add [Volo.Abp.BlobStoring.Azure](https://www.nuget.org/packages/Volo.Abp.BlobStoring.Azure) NuGet package to your project: -````bash -dotnet add package Volo.Abp.BlobStoring.Azure -```` - -After installation, add `DepenedsOn` attribute of the `AbpBlobStoringAzureModule` module to your [module](Module-Development-Basics.md). +* Install the [ABP CLI](https://docs.abp.io/en/abp/latest/CLI) if you haven't installed before. +* Open a command line (terminal) in the directory of the `.csproj` file you want to add the `Volo.Abp.BlobStoring.Azure` package. +* Run `abp add-package Volo.Abp.BlobStoring.Azure` command. -Whenever you add a NuGet package to a project, also add the module class dependency. +If you want to do it manually, install the [Volo.Abp.BlobStoring.Azure](https://www.nuget.org/packages/Volo.Abp.BlobStoring.Azure) NuGet package to your project and add `[DependsOn(typeof(AbpBlobStoringAzureModule))]` to the [ABP module](Module-Development-Basics.md) class inside your project. -### Configuring the Containers +## Configuration 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). @@ -36,19 +34,15 @@ Configure(options => > See the [BLOB Storing document](Blob-Storing.md) to learn how to configure this provider for a specific container. -## Options +### Options * **ConnectionString** (string): A connection string includes the authorization information required for your application to access data in an Azure Storage account at runtime using Shared Key authorization. Please refer to Azure documentation: https://docs.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string - -* **ContainerName** (string): You can specify the container name in azure. If it is not specified, the `ContainerName` of the `BlobProviderArgs` will be used. However, please note that Azure has some rules for naming containers. A container name must be a valid DNS name, conforming to the [following naming rules](https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#container-names). - -* Container-names rules: - - Container names must start or end with a letter or number, and can contain only letters, numbers, and the dash (-) character. - - Every dash (-) character must be immediately preceded and followed by a letter or number; consecutive dashes are not permitted in container names. - - All letters in a container name must be lowercase. - - Container names must be from 3 through 63 characters long. - -* **CreateContainerIfNotExists** (bool): Default value is `false`, If a container does not exist in azure, `AzureBlobProvider` will try to create it. Please refer to the naming rules mentioned above. +* **ContainerName** (string): You can specify the container name in azure. If this is not specified, it uses the name of the BLOB container defined with the `BlogContainerName` attribute (see the [BLOB storing document](Blob-Storing.md)). Please note that Azure has some **rules for naming containers**. A container name must be a valid DNS name, conforming to the [following naming rules](https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#container-names): + * Container names must start or end with a letter or number, and can contain only letters, numbers, and the dash (-) character. + * Every dash (-) character must be immediately preceded and followed by a letter or number; consecutive dashes are not permitted in container names. + * All letters in a container name must be **lowercase**. + * Container names must be from **3** through **63** characters long. +* **CreateContainerIfNotExists** (bool): Default value is `false`, If a container does not exist in azure, `AzureBlobProvider` will try to create it. ## Azure Blob Name Calculator @@ -57,13 +51,9 @@ Azure Blob Provider organizes BLOB name and implements some conventions. The ful * Appends `host` string if [current tenant](Multi-Tenancy.md) is `null` (or multi-tenancy is disabled for the container - see the [BLOB Storing document](Blob-Storing.md) to learn how to disable multi-tenancy for a container). * Appends `tenants/` string if current tenant is not `null`. +* Appends the BLOB name. -```csharp -var blobName = CurrentTenant.Id == null - ? $"host/{args.BlobName}" - : $"tenants/{CurrentTenant.Id.Value.ToString("D")}/{args.BlobName}"; -``` - -### Other Services +## Other Services * `AzureBlobProvider` is the main service that implements the Azure BLOB storage provider, if you want to override/replace it via [dependency injection](Dependency-Injection.md) (don't replace `IBlobProvider` interface, but replace `AzureBlobProvider` class). +* `IAzureBlobNameCalculator` is used to calculate the full BLOB name (that is explained above). It is implemented by the `DefaultAzureBlobNameCalculator` by default.