Coder Social home page Coder Social logo

Comments (6)

jedielson avatar jedielson commented on May 22, 2024 2

I respectfully disagree with this statement.

It goes away from CQRS principle that you should simplify your read models to optimize your queries.
Write models, like Customer don't fit well for queries.

from equinoxproject.

EduardoPires avatar EduardoPires commented on May 22, 2024 1

I disagree. We need to protect our entities. Never receiving or returning your domain models.

from equinoxproject.

alexsandro-xpt avatar alexsandro-xpt commented on May 22, 2024

+1

from equinoxproject.

thiagolunardi avatar thiagolunardi commented on May 22, 2024

Nothing outside the AppService should know anything about the Domain.

And the Domain entities are not related to "repository/database" entities. In this sample, as we're using EF, and it's really simple demonstration, it's fine. But you should try to avoid create your Entities being concerned about persistence.

from equinoxproject.

hugoestevam avatar hugoestevam commented on May 22, 2024

I get very confused about this topic approach.

Because as per the traditional approach or theory wise, ViewModel should be part of User Interface Layer. At least the name says so.

View models are intended to provide information to and from views and should be specific to the application, as opposed to the general domain.
For example, what if your system with several other client types, each requiring their own ViewModel. How do you know which ViewModel a method of your application service should return?

Perhaps more appropriately, if you have a separate viewmodel for each view associated with CustomerController, should CustomerAppService have a separate method to return each viewmodel?

I think not...but that does not mean that the Domain should be returned to the Client, the Controller or another layer (Distributed Layer) should handle this.

from equinoxproject.

thiagolunardi avatar thiagolunardi commented on May 22, 2024

View models are intended to provide information to and from views and should be specific to the application, as opposed to the general domain.

Just to increase the accurate: ViewModels just provide data to the view, not otherwise. In this scenario, if the client need to send any data to the application, then this should be made via commands.

the ViewModels, from AppServices, always returns RAW data. if the client - MVC, WebAPi, etc - need to format it's exist - eg. an endpoint just need to return {id,name}, and the RAW is {id,name,address,email}. So the client should have it's own custom format, at client - WebAPI, MVC - side.

So, you're are correct, every app service call can have it's own return.

from equinoxproject.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.