M
M
Mikula212018-11-23 08:28:07
ASP.NET
Mikula21, 2018-11-23 08:28:07

Need to separate entities from methods?

ASP.NET MVC application. Infrastructure layer.
There is a ConcreteRepository repository which has a GetConcreteData(inputData) method. Inside it is sending a PostRequest (url) request that receives data in JSON format from the microservice and maps this Json into an object of DataJson type.
Example:

public class ConcreteRepository
{
   public ModelDto GetConcreteData(Model inputData)
   {
       var result = PostRequest<DataJson>(url);
       ...
       return resultDto;
    }
}
public class DataJson
{
   public int _id {get;set;}
   public string _name {get;set;}
   ...
}

The question is: Where is the best place to store DataJson? Inside a repository or outside of that repository? If possible, describe the pros and cons of both methods.
PS: Personally, I would take DataJson out of the repository, since the model and methods in one place worsen the readability of the code (intuitively)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question