The book is published in 2014 so it is starting to show some age. Even though ASP.NET MVC 5 is the last version until it changed the name to ASP.NET MVC Core which is in version 2, see the version history here. So why read a four year old book? Many projects still use MVC 5 and it allowed me to gain an overview of the technology before diving into MVC Core. Unless you have a particular interest in MVC 5 I would recommend a book about MVC Core instead.
At 624 pages and 17 chapters, I read it in a couple of weeks. It does start to show it’s age when referencing jQuery and AngularJS, it is rather old versions mentioned. But the chapters about the MVC framework are sound and contains a good walkthrough about each main feature of the framework. If you need a primer on MVC 5 I will recommend it.
When I read it helps me to write a few notes for each chapter to make it easier to remember. Hope it helps someone.
Reuse HTML components is called partial views and allows the developer to separate an HTML structure into a file that can be rendered in many places, like this:
@Html.Partial("AlbumDisplay ")
Validation. ASP.NET allows a developer to reuse the same validation mechanism both in the backend and the frontend, skipping the need to duplicate code. It is controlled by attributes, like adding a [Required] attribute to a field in a model.
It even supports validating a field clientside by a callback to the server.
public string UserName { get; set; }
This will call the CheckUserName function to validate the field.
Error messages are also handled.
Security is controlled using attributes on the controllers. Using either roles or claims. ASP.NET come with a complete identity system that you can use to get running fast. It uses the ASP.NET identity system. Be aware that 2.0 is released after the book is written.
It supports external auth systems like OAuth, Windows Auth, Facebook, Google and so on.
The chapter spends many words on describing why issues like XSS is a problem. No really worth a read in my opinion. There are better resources for that.
A hint for making configuration easier is to use retail deployment configuration. It allows you to set a special configuration variable on the machine so it knows if it is a development or production machine.
The file is located at %windir%\Microsoft.NET\Framework\\<frameworkversion>\Config\machine.config.
Here the book shows age, much of jquery can be replaced by standard JavaScript by now. Lots of info about how jquery works.
Serverside validation can be pushed to clientside automatically. A little bit around bundles but not much, using bundles you can package js and CSS files so they can be preprocessed by ASP.NET
Routing is not part of ASP.NET MVC but actually part of ASP.NET. Attributes can define routing, but so can the traditional approach using a code in a centralized place.
Routes can be added both to the controller class and the action methods and allow pattern matching. Routing constraints can be added using both data types and regex.
If you want to unit testing routes the books provide a few tips, but it does not work with attribute routes, which is the modern approach.
Routes can be used to generate links from Razor - use named routes to avoid problems. For debugging routes the DebugRouteHandler is handy
Walkthrough of how to use NuGet, both to download/install packages and to publish. Not very ASP.NET specific.
Separate framework - notice that in ASP.NET Core they are combined into the same framework.
Async by default, the output is mapped to different formats based on the request(JSON, XML and so on).
To help to generate documentation the framework automatic discovers the API endpoints and can use that to generate documentation.
The framework supports tracing(logging) just plugin your favorite logging library and it will start tracking automatically.
Very AngularJS specific uses Web API as the backend. Not worth a read because the version of AngularJS that is used is deprecated.
There is no default implementation for dependency resolver, just an interface.
ASP.NET supports two different service models. competitive services and cooperative services. For Competitive services, the first service that can serve the request handles is, the remaining services are not asked. With Cooperative services, every service is allowed to process the request.
Controllers with constructor parameters can be constructed with Dependency Injection and MVC will instantiate them using a controller activator class.
Web API Dependency Injection is a bit different, supports scopes, but I did not find it very useful.
General advice on unit testing and TDD. Only a few hints to how it is possible to implement unit tests in ASP.NET MVC.
Advanced topics which most will never use, but is nice to know about. I guess that by the time you get to need this you will just use the Microsoft documentation directly.
When outputting ASP.NET MVC supports two different modes. Either responsive web design, or display modes where the server guess which device did the request and serves different HTML based on that.
In my opinion, responsive web design is the correct way to go, at least for the time being.
Tips about templated razor delegates (lambda for razor templates).
Building a website. Actually, a good read to understand all of the concepts. Most of the reading will be in the supplied code. The code can be found here.
Legal Stuff