Base solution for your next web application
Open Closed

Why not simply export excel from stream? Why use cache to download excel? #9397


User avatar
0
sempus created

Hi, In BackEnd, I see we have file "...ExcelExporter.cs" (define method ExportToFile). And service file "...AppService.cs", we use this method - ExportToFile (Stream File saved TempFileCacheManager) Afterthat, in FrontEnd (Angular) we call method Download from Cache. My question is, Why complicate so many steps? Why use caches here? Why don't we download it directly from the stream NPOI? Thanks.


3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi

    See https://github.com/aspnetzero/aspnet-zero-core/issues/1335 https://github.com/aspnetzero/aspnet-zero-core/issues/1493

  • User Avatar
    0
    sempus created

    Hi, I still don't feel satisfied With Excel Export case, Why don't we use "return File" as soon as we get the exportfile stream? I just want to understand the real reason we chose to use the cache here. Thank

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @sempus

    It also helps using this functioanlity if you have deployed more than one instance of your app. In case of more than one instance deployment, excel file download might fail.

    If you don't have such a scenario, you can simply change it.