Back to Abp

BLOB Storing Memory Provider

docs/en/framework/infrastructure/blob-storing/memory.md

10.3.01.6 KB
Original Source

BLOB Storing Memory Provider

Memory Storage Provider is used to store BLOBs in the memory. This is mainly used for unit testing purposes.

Read the BLOB Storing document to understand how to use the BLOB storing system. This document only covers how to configure containers to use the memory.

Installation

Use the ABP CLI to add Volo.Abp.BlobStoring.Memory NuGet package to your project:

  • Install the ABP 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.Memory package.
  • Run abp add-package Volo.Abp.BlobStoring.Memory command.

If you want to do it manually, install the Volo.Abp.BlobStoring.Memory NuGet package to your project and add [DependsOn(typeof(AbpBlobStoringMemoryModule))] to the ABP module class inside your project.

Configuration

Configuration is done in the ConfigureServices method of your module class, as explained in the BLOB Storing document.

Example: Configure to use the Memory storage provider by default

csharp
Configure<AbpBlobStoringOptions>(options =>
{
    options.Containers.ConfigureDefault(container =>
    {
        container.UseMemory();
    });
});

UseMemory extension method is used to set the Memory Provider for a container.

See the BLOB Storing document to learn how to configure this provider for a specific container.