5

I want to add Excel and PDF generator in my new Solution in dotnet core 6. I following this template: https://github.com/iammukeshm/CleanArchitecture.WebApi

or

https://codewithmukesh.com/blog/onion-architecture-in-aspnet-core/#Getting_Started_with_Onion_Architecture

it really good clean architecture tutorial for dotnet core. In my understading, Excel Generator or PDF Generator will placed in Application/Features

For Example to download Invoice Report in Excel File, so the path will be

Solution
|- Application
    |- Features
        |- InvoiceFeature
            |- Commands
            |- Queries
            |- Generates
                 |- GenerateInvoiceByDateRangeInExcel.cs

and in controllers I will add

        [HttpPost]
        public async Task<IActionResult> DownloadExcel(GenerateInvoiceByDateRangeInExcel command)
        {
            return File(await Mediator.Send(command));
        }

Honestly I dont try this idea first, so back to my question

Where I should put Excel/PDF generator class or function in Onion/Clean Architecture? and how to use it properly using Mediatr

yozawiratama
  • 4,209
  • 12
  • 58
  • 106
  • were you able to implement your solution? Where did you put the pdf generation code? I have to implement text file generation with clean architecture, if you can share your final approach, that will be nice! Thanks – Marcel Callo May 30 '23 at 13:00

0 Answers0