The difference between the model, DTO, and command of ASP.net mvc

Source: Internet
Author: User

Recently in the CQRS architecture model to do projects, some sentiment, recorded.

The description of the question (do you have any similar situation?) ):

From the beginning, the project did not distinguish between these 3 objects, so that a lot of responsibility to the public, and then chaos, such as command part of the responsibility needs to be used in asp.net mvc, so defined in the underlying DLL, and posted a pile of dataannotation tag to the property , including a lot of remote verification, front-end JS validation components of the verification tag, very magnificent. Back-end CommandHandler over there in the Domainservice DLL, because of the misunderstanding of data conversion, so also used a mess.

My current understanding:

asp.net MVC's model layer is not small, this is a fine-grained object, and the UI has a strong connection, in these object definitions need to put a heap of validation tag and UIHint

The command object, which is a definition of an object that is involved in a specific business behavior, does not have much to do with the UI (but does not mean that it does not), and the name and attributes of the command change depending on the progress of the project, in effect looking at changes in demand and understanding of the business The Command object defines the properties of server-side validation (by the way, the Commandbus of the A2D framework verifies the legality of these command after each commandbus.send).

The DTO, which is the meaning of data transfer object, is too wide to describe, and later found that in Cqrs, the DTO mainly refers to the query dto.

Here's another picture of CQRS (see if you can match the above 3 objects):

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/aspx/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.