Comments (6)
Sorry for the delayed response, I am trying hard to catch-up.
It is somewhat of a convention that I am following. Queries return a single VM composed of DTOs. I want the VM to be associated with a single view. VMs should not be shared across views. DTOs could potentially be shared but I would try to minimise sharing where possible. This is because I want to avoid creating conditional logic for separate (but closely matched) use cases and I want to avoid breaking changes (change one query, break another).
@ardalis had a couple of great weekly dev tips on this topic:
I also like the Request / Response approach, e.g. GetCustomersRequest and GetCustomersResponse. It is probably a better representation of the use cases and results and I think it would be nicer when writing client code.
Open for suggestions. 😀
from cleanarchitecture.
I agree with the previous comments. They are, in essence, just terms and there are many valid ones as shown above. Personally, since we are using the Request/Response pattern, I would call them *Request for the input and *Response for the output.
from cleanarchitecture.
Those are just terms in this context, I guess. The *Vm
ones are more like containers for complex responses. *Dto
is a single entity. You may also always use the Representation
suffix.
Nonetheless I agree with Vm
being a bit confusing. Can't think of a better name like Container
for now tho.
from cleanarchitecture.
I just use the term Model usually
from cleanarchitecture.
As I know, by DDD we should return DTOs from application layer.
DDD has no correlation to the Application layer. It doesn't even know it exists.
VM vs DTO is an Application layer concern only. It doesn't matter which type you choose, it just depends on your use case. This solution comes with examples for both.
from cleanarchitecture.
As I know, by DDD we should return DTOs from application layer.
DDD has no correlation to the Application layer. It doesn't even know it exists.
VM vs DTO is an Application layer concern only. It doesn't matter which type you choose, it just depends on your use case. This solution comes with examples for both.
Actually, DDD do have a notion of Application Layer. Taken from Evans' Domain Driven Design book
Application Layer: Defines the jobs the software is supposed to do and directs the expressive domain objects to work out problems. The tasks this layer is responsible for are meaningful to the business or necessary for interaction with the application layers of other systems. This layer is kept thin. It does not contain business rules or knowledge, but only coordinates tasks and delegates work to collaborations of domain objects in the next layer down. It does not have state reflecting the business situation, but it can have state that reflects the progress of a task for the user or the program.
But it is true that the domain layer should have no notion of the application layer since the dependency flow inward.
To be fair, DTO is, in essence, an umbrella term that defines an object made to transport data in between process/layer.
from cleanarchitecture.
Related Issues (20)
- No IServiceMetadata Generated When Adding .NET Aspire Support
- Scaffolding Identity UI. HOT 3
- Add Blazor Support HOT 7
- Users is missing in Swagger and API specification HOT 3
- It is impossible to launch a new project HOT 9
- Making the Application layer independent of any specific technology or external library. HOT 3
- angular UserService
- NullReferenceException for functional tests after creating a new project with the template HOT 1
- Introducing an AI-driven GPT Model for Automated EF Core Entity Generation HOT 1
- Add Web.GrpcServer [gRPC Server] HOT 1
- Can not get Entity.Id on Events (always 0) HOT 1
- Migrations Issues
- Angular 17, standalone HOT 2
- Can't create migrations HOT 2
- Swagger Specifications are incomplete
- FluentValidation not triggered HOT 1
- upgrade angular spa client to 17
- Angular 17 post data to dotnet core8. Json deserialisation of bool failed HOT 1
- Implement Universal Reflection-Driven MappingProfile for Cleaner DTOs HOT 1
- Azure.Identity 1.10.4 moderate severity vulnerability HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cleanarchitecture.