iammukeshm/CleanArchitecture.WebApi

Some doubts with the structure of the template

lavilaso opened this issue · 1 comments

Hi, great work with this template. Right now I am testing your template and would like to hear your thoughts regarding the following topic:
I have a scenario where I want to use your template to implement a test backend, this backend will be consumed by a Xamarin mobile app and I am stuck at the point of sharing DTO's, I don't think the best option is to create a dependency from my Xamarin project to the application layer, so I have thought about taking the DTO's to a separate project that is consumed by the application layer and the app.
Something that is difficult for me to understand is also the relationship between DTO's and ViewModels that I see in some Queries, can you explain it?
I hope you can let me read your thoughts regarding all of the above.
Thank you

As you pointed out, the DTOs or for that matter any class in the Application/Domain Layer should never be shared with an API Consumer Project. The Consumers should have their own implementation of the class. DTOs are placed in the App Project because of the inverted DI. So, If you want to add let's say another API with the same business Logics, the same class could be reused (Same Enterprise Logics). It's not a good idea to share the DTO among the API consumers as it may raise other conflicts in the longer run.
I Intended DTOS to be the transport class that is not included at the CQRS Implementation and only for Service Classes.