Where I should put Excel/PDF generator class or function in Onion/Clean Architecture?
Asked Answered
C

0

6

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

Cavuoto answered 10/6, 2022 at 3:23 Comment(1)
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! ThanksKriemhild

© 2022 - 2024 — McMap. All rights reserved.