Open Closed

DYNAMIC BLOB STORAGE OPTION #2805


User avatar
0
shijo created

This is a query regarding the dynamic blob storage option in abp.io. As per the current documentation, I have to add the provider options in the module class. Our requirement is, per tenant the provider options may vary. Is it possible to dynamically configure the provider options?


1 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi @shijo
    ABP Framework doesn't provide a configuration for tenant-based blob provider resolution. There are a couple of ways to achieve tenant-based storage.

    1. You can try to use different containers across your tenants.

    2. You can manually resolve BlobProvider according to CurrentTenant via using IServiceProvider.

      var provider = serviceProvider.GetRequiredService<AzureBlobProvider>();
      // Or with type
      var provider = (BlobProviderBase) serviceProvider.GetRequiredService(typeof(AzureBlobProvider));
      
      // According to a rule:
      var provider = (BlobProviderBase) serviceProvider.GetRequiredService(providerMappingDictionary[CurrentTenant.Id]); //Dictionary returns type
      
      await provider.SaveAsync(...);
      
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 13, 2025, 04:08