DDD C# - In which layer should I implement the Data export part

Asked

Viewed 678 times

0

I am developing an application in C# and WPF, with several registrations as Customers, Suppliers, Products, etc. I am using the DDD concept and I have a question about how to implement a data export module. I will need to export data and the files will be in xml, csv and txt format.

On which layer do I implement this module? Does anyone have an example?

inserir a descrição da imagem aqui

  • 3

    I would put the reading and writing of the file in the Infra.Data and put the data assembly rule in the Domain.

  • In this case, I would create Interfaces similar to those of CRUD with Entityframework?

  • Could be in this case.

  • Thanks for the tip joaoeduardorf!!

2 answers

2

I assume that this report module will use some Frameworks to generate these Excel (Epplus example) and PDF (Itextsharp example), so it is interesting you create this in the layer of Crosscutting to decouple these Frameworks from your Application layer. If one day one of these Framework becomes obsolete or you want to make another, my business rule layer will not be changed.

The Crosscutting layer serves exactly for system modules that influence other modules, such as persistence layer, services, etc. As an example of things done in the Crosscutting layer are security module, LOG system, and also for case of your reports.

1

Buenas, the "correct" (depending on the case), would be put in the Application, because theoretically, you have to pass in Domain to export data consistent and the layer that has the business rules that consists of The data is Dominio. So the normal would be to have this responsibility in the Service layer (not domain service), not in the data layer, nor in the business layer (domain), depending on how you will export could be up to in the presentation.

if you did not understand or want more details just call...

ps: if you want to know more about these questions of where to put and how to do recommend the implementing Vaughn Vernon’s Domain drive desing... abrs

Browser other questions tagged

You are not signed in. Login or sign up in order to post.