According to this blog post "ModelMetadata objects are constructed with data taken from attributes, primarily from the System.ComponentModel and System.ComponentModel.DataAnnotations namespaces."
By putting UI helper attributes on Model objects (DisplayFormat or UIHint) aren't we coupling Model and View?
Separation of concerns is a software architecture design pattern/principle for separating an application into distinct sections, so each section addresses a separate concern. At its essence, Separation of concerns is about order.
As per Wikipedia, "the process of breaking a computer program into distinct features that overlap in functionality as little as possible". The purpose of the MVC design pattern is to separate content from presentation and data-processing from content.
In computer science, separation of concerns is a design principle for separating a computer program into distinct sections. Each section addresses a separate concern, a set of information that affects the code of a computer program.
The Model-View-Controller (MVC) pattern is an architectural design principle that separates the components of a Web application. This separation gives you more control over the individual parts of the application, which lets you more easily develop, modify, and test them. ASP.NET MVC is part of the ASP.NET framework.
I believe so. Personally I keep my model completely ui-agnostic and I write ViewModels which will represent my model in my View. Then assign all annotations to these ViewModels.
I think the violation comes from the fact that this limits your ability to reuse your model, since you are basically defining view behavior in your model.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With