Open Closed

File Management Module is only using database and not the Azure Blob #7189


User avatar
0
vipulbuoyancy created
  • ABP Framework version: v8.1.0
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue: I am trying to configure the File Management module to get data from Azure Blob instead of Database. But after following all the steps based on your document, it is still using the database only.

16 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    . But after following all the steps based on your document, it is still using the database only.

    Please share your configuration code.

  • User Avatar
    0
    vipulbuoyancy created

    Hi @maliming,

    I have used below code for Azure configuration. I have tried by adding below code in Domain, Application & APIHost module.

    Configure<AbpBlobStoringOptions>(options =>
    {
        options.Containers.ConfigureDefault(c =>
        {
            c.UseAzure(container =>
            {
                container.ConnectionString = configuration["Azure:BlobConnectionString"];
                container.ContainerName = configuration["Azure:BlobContainerName"];
                container.CreateContainerIfNotExists = true;
            });
        })
        options.Containers.Configure<FileManagementContainer>(c =>
        {
            //c.UseDatabase();
            c.UseAzure(container =>
            {
                container.ConnectionString = configuration["Azure:BlobConnectionString"];
                container.ContainerName = configuration["Azure:BlobContainerName"];
                container.CreateContainerIfNotExists = true;
                // Add other configurations as needed
            });
        });
    });
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Your code seems no problem.

    Can you share a simple project? liming.ma@volosoft.com

  • User Avatar
    0
    vipulbuoyancy created

    Sure, I will share the test project in sometime. Meanwhile can you please help me which is the right project to add the above configuration from these 3 Domain, Application & APIHost?

    Thank you.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You should add it to ConfigureServices method of APIHost project

  • User Avatar
    0
    vipulbuoyancy created

    Hi @maliming, I tried to creating a new clean project but getting some error in lepton theme, may be because of version. But you can try from your end.

    I have followed below steps

    1. Created a new project
    2. Added File Management Module
    3. Added "Volo.Abp.BlobStoring.Azure" package in Api.Host project
    4. Added below code in ApiHostModule.cs file
    private void ConfigureAzureBlob(IConfiguration configuration)
    {
        Configure<AbpBlobStoringOptions>(options =>
        {
            options.Containers.ConfigureDefault(c =>
            {
                c.UseAzure(container =>
                {
                    container.ConnectionString = configuration["Azure:BlobConnectionString"];
                    container.ContainerName = configuration["Azure:BlobContainerName"];
                    container.CreateContainerIfNotExists = true;
                });
            });
    
            options.Containers.Configure<FileManagementContainer>(c =>
            {
                c.UseAzure(container =>
                {
                    container.ConnectionString = configuration["Azure:BlobConnectionString"];
                    container.ContainerName = configuration["Azure:BlobContainerName"];
                    container.CreateContainerIfNotExists = true;
                    // Add other configurations as needed
                });
            });
        });
    }
    
    1. Call above method from ConfigureServices method.
    2. Run the Api Project & Angular project
    3. When I open the File Management UI page. I am expecting the folders & files should come from my Azure container. Also When I create a new folder it should create the folder in Azure blob container. But it is adding the entry in FmDirectoryDescriptors table in the database.

    Please help me what I am doing wrong.

    Thank you.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    When I open the File Management UI page. I am expecting the folders & files should come from my Azure container.

    This is by design. Only file/blob will be stored on Azure. The file and folder info will be stored in the FM database.

  • User Avatar
    0
    vipulbuoyancy created

    oh okay, so you mean, If I upload a file inside that folder it will go to azure, right?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Yes. Azure is used store file. The FM module is used to store file/folder info.

  • User Avatar
    0
    vipulbuoyancy created

    Ok thanks for clarification. It is uploading file in the azure. Can you please help me, if I can have any way to manage the organize data in azure?

    Also, If I want to upload a file from coding, do we have any accessible method of file management module to create folder in file management module? So I can have track of all the documents uploaded from code in file management module.

    Thank you so much for your help.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    if I can have any way to manage the organize data in azure?

    This is not the initial design of the FM module.

    If I want to upload a file from coding, do we have any accessible method of file management module to create folder in file management module? So I can have track of all the documents uploaded from code in file management module.

    You can inject the Domain or AppService services to upload and manage the file/folder.

    https://docs.abp.io/en/commercial/latest/modules/file-management#domain-services https://docs.abp.io/en/commercial/latest/modules/file-management#application-services

  • User Avatar
    0
    vipulbuoyancy created

    Hi @maliming, Thank you for your reply. I got how to manage the files & folder programmatically.

    Can you please help me how to override the getall api of file management module? Like I just want to display files & folder of specific folder instead of all folders by default.

    Or is there any way so I can use the UI of file management module and use my api to get list of files & folders?

    Thank you.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you please help me how to override the getall api of file management module

    You can check this document to learn how to override the services in the module.

    https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Guide

  • User Avatar
    0
    vipulbuoyancy created

    Thank you @maliming for your help. Can we use the file management component as a child component in other page?

  • User Avatar
    0
    vipulbuoyancy created

    Hi @maliming, I make it working. Thank you so much for all your help.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Good news!

Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38