Section 1: ASP.NET MVC 5 And Core Overview

The ASP.NET Model-View-Controller (MVC 5/Core) architectural pattern, like the classic MVC architectural pattern explained in an earlier section, separates an application into three main components: the Model, the View, and the Controller. The ASP.NET MVC 5 presentation framework is similar to existing ASP.NET 4.5/4.6 features; e.g., master pages and membership-based and identity authentication and authorization. The MVC framework is contained within the System.Web.Mvc assembly reference.

As explained earlier, the MVC pattern helps developers create applications that separate the different sections of the application (input logic, business logic, and UI logic), while providing a loose coupling among these elements. The pattern specifies where each kind of logic should be located and their responsibilities in the application. The UI and presentation logic belongs in the view; input logic and processing occurs within the controller, and, finally, business logic belongs in the model layer of the application. This separation helps a developer manage complexity when building an application, because it enables the programmer to focus on one aspect of the development at a time. For example, a programmer or designer can focus on the view without interfering with the business or model logic development.

The ASP.NET MVC template makes it easier for the developers to test MVC applications than it is to test a Web Forms-based ASP.NET Web application template. For example, in an ASP.NET Web application, the web form code-behind class is used both to display output and to respond to user input and actions. Creating unit tests for ASP.NET web form applications can be difficult, because to test an individual page, you must instantiate the page class, all its child controls, and additional dependent classes in the application. Since so many classes are instantiated to run the page, programmers find it hard to write unit tests that focus specifically on the individual parts of the application. Tests for Web Forms-based ASP.NET applications are more difficult to implement than unit tests in an MVC application. Moreover, tests in a Web Forms-based ASP.NET application require a web server, but the MVC framework decouples the components and makes heavy use of interfaces. This makes it possible for a programmer to test individual components like class methods in isolation from the rest of the application.

The ASP.NET MVC framework provides the following advantages over the ASP.NET Web Form application framework since it:
  • is easier to manage business process and development complexity by dividing an application into the model, the view, and the controller.
  • does not use view state or server-based forms which makes the MVC framework well-suited for developers who want full control over the behavior of an application.
  • uses a Front Controller pattern that processes user and application requests through a single domain controller which enables a developer to design an application that supports a rich routing infrastructure.
  • provides better support for test-driven development (TDD).In general, it is less complex for application development, because the components (the Page class, controls, and so on) are tightly integrated and usually require less code than the MVC model. and web designers who need a high degree of control over the application behavior, look, and feel.

The ASP.NET web forms-based framework offers the application developer the following advantages since it:
  • supports an event model that preserves state view over HTTP postback which makes line-of-business web application development easier. The ASP.NEt web forms-based application template and frameork provides a choice of events supported a lot of server control choices.
  • utilizes a code-behind page controller pattern that adds simple event driven functionality to individual web pages; e.g., a button click event handles user mouse clicks on the button.
  • uses view state on server-based forms that makes managing state information easier.
  • works well for small teams of web developers and designers who want to take advantage of the large number of controls and other components available for rapid application development.
  • is generally less complex for application development because the components (the code-behind page class, controls, and other components) are tightly integrated and usually require less code than the ASP.NET MVC model.

Section 2: ASP.NET 5 and MVC Core


View ASP.NET 5 and MVC Core


Section 3: Dependency Injection (DI) and Inversion of Conrol (IoC) Deep Dive


View DI and IoC


Section 4: Collections and Generics


View Collections and Generics


Section 5: C# Methods and Test Driven Development (TDD)


View C# Methods and Test Driven Development (TDD)


Section 6: ASP.NET Core Tag Helpers


View ASP.NET Core Tag Helpers


Section 7: ASP.NET MVC and Core OWASP Boilerplate Security Template


View ASP.NET MVC and Core OWASP Boilerplate Security Template