For me this seems obscure, but after reading the information in the following:
http://weblogs.asp.net/scottgu/archive/2010/02/05/asp-net-mvc-2-release-candidate-2-now-available.aspx
http://bradwilson.typepad.com/blog/2010/01/input-validation-vs-model-validation-in-aspnet-mvc.html
http://blog.stevensanderson.com/2010/02/19/partial-validation-in-aspnet-mvc-2/#comment-35397 (in particular, some of the comments)
It seems that the idea of Asp.Net MVC is that you have a one-to-one relationship between models and views. This seems to run counter to the DRY principle and several other standard programming practices.
For example, let's say you have a user account model, and two types are available for editing: one for the user who needs to edit it, and one for the site administrator to edit it. The administrator has access to an additional field for something internal, necessary, but the user cannot view and edit it. According to the model binding functionality and beliefs described in the posts mentioned above, I would need to create two separate user models, one for each page, and the only difference would be this additional field. This is just a simple example, I have a few that I saw where it could potentially mean 5 or 6 different models for the same object, just a few fields that are different from each other.It really makes no sense to me.
, , , .
UserModel , , .
, , usermodel (User.Address), ( street, city IAddress).
- , .
, , . . DataAnotations, , . DataAnnotations - , .
, "" " ". viewmodel , .
ASP.NET MVC. .
, . , , , , - . , , "" , , , , .
TL; DR: . .
", , DRY ".
[ ]?
MVC , . , , XML, -, .
DRY -. FirstName CRUD . 5-6 , ? 40 ?
- , homoiconisticish screen, , / -.
You are not really programming when you make silly definitions. This work can be easily done in Access GUI or defined in XML. The fact that your view-screen models are in C # just makes it easy to populate them with data and send them and work with tools like WCF and Automapper.
Source: https://habr.com/ru/post/1748865/More articles:CSS text selection? - cssCalculating Spam Probability - probabilityImageUrl in user control mode - asp.netHow can I combine code from a branch into a trunk? - mergeStop execution hook_user Drupal - drupalNSImage of various sizes in code other than Finder / Preview - cocoaC ++ - Where to throw an exception? - c ++Display inline images in Flash / Flex Builder - flexHow to save a large "database" class in python - pythoncPickle class saving data to file - pythonAll Articles