Recently I've read, and implemented 80% of examples from Pro ASP.NET MVC Framework, and it seems like the authors have only given the basics. After reading this I did become able to build web applications using ASP.NET MVC. But that's just basic applications.
What I found most confusing is that at the beginning the authors emphasized on the model as the primary component of the MVC application, but later on completely forgot about that, focusing on views, helper methods, controllers, tests (I spent more time writing code for tests, than the application itself), web security, third party software for doing stuff better, but without proper explanation of a Model's place in ASP.NET MVC. In the book, in the largest example, the code which I would categorized as a model, was placed completely in another project, and not one single file was created in the Models namespace.
Here are the things that I feel that are 100% necessary in building solid applications using MVC:
- Proper validation, model-side. I've seen in many examples on the internet it is done using annotations. Where to find a comprehensive documentation on annotations used for data validation for ASP.NET MVC?
- Best practices in code organization within the model. I may have many entities/classes that need defining. Should I create separate files? Are there any interfaces or helpful base classes in ASP.NET MVC framework that I should know about?
- Should HTML field names be defined in the view using plain HTML, or in the model, using annotations? Where does the role of the model in ASP.NET MVC have to end?
- What are the best practices of using ORM tools with models in ASP.NET MVC? How should updates take place if the DataContext is discontinued? Where should the updatable properties of the entity be set? In the controller before being passed to the model for update? Or in the model?