How to implement a text file export/import layer in DDD and how it will relate to the other layers

Asked

Viewed 188 times

0

I’m basing myself on an Eduardo Pires project Here and I have some questions about implementing a unique layer for importing and exporting database information in csv, txt, xls, among others. For this, I created as part of Infrastructure, an Inputoutput layer where I will create import and export methods for each class.

Doubt 1: To create such methods I need to make a generic repository similar to the one we use in the Data layer to do CRUD in the Database with EF, for example?

inserir a descrição da imagem aqui

Doubt 2 - About the Services and Domain: In my Application layer I already have the services to do the CRUD that Map and direct to Command classes of the Domain layer to make validations and save/query the bank information. Because it’s Exports, do I need to build command classes on my domain and the domain to direct the flow to the Inputoutput layer or simply, the service class I direct the flow directly to the Inputoutput layer without going through the domain and validating anything? I have doubts if it would need to validate, because since the data are processed in the database, it would only be to save them in a text file.

Very grateful to all who can help me!!!

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

1 answer

-1

Doubt 1: It makes more sense for you to reference the Date project in your Exports project since you will need to access the database anyway and you will need all the data structures that are already defined in the Data project.

Doubt 2: In general all features go through the domain, mainly projects that use CQRS to uncouple reading from writing. Its functionality may be to just return a file now, but in the future it will evolve and log an export call log, for example. Developing this new functionality will be much less costly if there is already a representation of it in the domain layer, even if it is for a very simple functionality.

Next time, please ask a question for each question, even if they are related.

Browser other questions tagged

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