ASP.NET Core Quick Start Review
Welcome to this review of http://aspnetcorequickstart.com/ by Steve Smith.
ASP.NET Core Quick Start is a Dev IQ course, making a change from my regular reviews of Pluralsight courses. The course sells for $49.99 and I will be comparing it to other online course offerings at the end of this review.
You don’t need to have any previous experience of ASP.NET Core, or even much programming experience at all, to learn this course as Steve takes you all the way from the beginning.
It is beneficial, but not essential to have some very basic prior knowledge of web servers such as IIS.
I recommend learning the basics of the C# language and web programming before watching this course. You should understand common programming terms such as constructor, dependency, MVC, lambda, async and middleware. You will probably get some benefit from the course even if all of those terms are unfamiliar however.
It is mostly aimed at people who are new to ASP.NET Core but also contains more advanced content later on that is useful to intermediate and even highly experienced developers.
The Agenda for the course is:
- ASP.NET Core Goals and Benefits
- Installing ASP.NET Core
- Creating ASP.NET Core Apps in Visual Studio and VS Code
- ASP.NET Core Startup
- Injecting Dependencies in ASP.NET Core
- Real World Middleware
- ASP.NET Core MVC and Web APIs
- Testing ASP.NET Core Apps
- Clean DDD Architecture for Non-Trivial ASP.NET Core Apps
A feature that I find really important with online training is the ability to change the playback speed. Dev IQ allows you to choose between 1x, 1.25x, 1.5x, 1.75x or 2x. For this course I found 1.5x works well. Unfortunately it changes back to 1x again after each video clip, or other server side change. It’s a little annoying having to keep resetting this and I hope that Dev IQ change this to a cookie based solution soon.
The Goals and Benefits video clip begins with an explanation of ASP.NET 4.6 and ASP.NET Core 1.0. I recommend having a read of the latest news from Build 2017 on ASP.NET Core 2.0 conjunction with this.
Steve then explains the relationship with GitHub and many other benefits of this technology, including statistics on how fast it is.
Chapter 3 covers Creating Apps in VS and VS Code, beginning with an introduction to the various project templates. This course covers ASP.NET Core 1.1 but there is likely not going to be any significant difference in future versions.
There’s a demo showing how to find your ways around a basic Web Application in Visual Studio 2017. Next we see the command line interface and some useful commands. Steve runs these commands from his Mac’s bash terminal. So by the end of this chapter you should know how to get started.
Chapter 4 introduces WebHostBuilder and shows how to use it to build a minimal ASP.NET Core application, i.e. a hello world web app.
10 minutes in, Steve introduces the Startup class, which is useful for configuring how our app behaves. He describes the constructor, ConfigureServices and Configure methods, and then gives a demonstration explaining the default web application code.
Also see Steve’s article Hosting in ASP.NET Core.
This covers Built-in and Custom Middleware. As described in the Microsoft documentation, middleware are “software components that are assembled into an application pipeline to handle requests and responses”.
Steve likens middleware to nesting dolls, and we see a diagram showing how three pieces of middleware interact with each other in a nested fashion.
We see examples of some common functions for creating middleware:
We see a demonstration of how to create custom middleware in Startup, beginning with how to chain together two pieces of middleware with app.Use. We see our app displays either “Hello, world!” or “Hello, students!” depending on the URL we enter.
You don’t really want a lot of middleware code inside of your Startup class and Steve shows an example with your middleware in its own class, and demonstrates how to do this in Visual Studio Code. Fifteen minutes into this chapter we see the behavior is the same but our code is now much cleaner.
But as Steve explains, for most apps we don’t need to write our own middleware because there are already a selection of middleware to choose from. Steve describes the following pieces of Diagnostics middleware:
Seventeen minutes in, we see a demo of all of these middleware.
Finally, these other middleware are introduced:
To keep our code easy to maintain, we want it to be modular and loosely coupled, and we can achieve this using Dependency Injection.
If you are a Pluralsight subscriber, Steve Smith has also produced a course on the SOLID principles of Object Oriented Design which includes a through tutorial on Dependency Injection and Dependency Inversion.
However, Steve also introduces the concepts here and even if it is all new to you, once you see the examples you’ll understand that Dependency is essentially a $20 dollar term for a 20 cent concept!
Steve explains the Explicit Dependencies Principle and how it is important for looser coupling, followed by the Dependency Inversion Principle.
These principles lead us to what is sometimes called “Poor mans dependency injection” — manually constructing many objects. Inversion of Control (IOC) containers make use of the Factory pattern to significantly reduce the amount of work you need to do.
Steve explains some of the IOC containers available with ASP.NET Core. We learn IServiceProvider and IServiceCollection here, as well as the Transient, Scoped and Singleton Service Lifetimes.
9 minutes in, we see a dependency injection demonstration using Visual Studio Code, and this moves onto the HomeController 14 minutes in. There is nothing very complicated with this technique, but it is very powerful and leads to much more maintainable and testable code.
The demonstration includes creating a TimeService and a MessageService and the effect of the different Service Lifetimes on the program behavior.
Finally, Steve gives some advice about Service Lifetimes with Entity Framework Core.
The aim of the video clip on MVC and Web API is to get you started writing business applications on top of these frameworks.
Steve begins by explaining what MVC is, discusses Controllers and Actions, and Returning Data or Views. He talks about the difference between models and viewmodels, and then moves on to describe ASP.NET MVC data annotations such as [HttpGet] and [AllowAnonymous].
We see that it is just a simple one line of code to return any of the following views or objects:
- default view
- view with a viewmodel
- a view with a specified name
- an object formatted based on request
- a JSON-formatted object
- a 200 HTTP status
- OK result with data
- a 400 Bad request status
Steve then gives a demonstration in Visual Studio showing all the relevant Microsoft AspNetCore and EntityFrameworkCore dependencies.
We see examples of returning specified views, and a view with a viewmodel containing contact details (Name, BlogName, BlogUrl and Twitter).
Steve and I are both fans of Postman and we see some of the useful features that this free tool offers us.
We see some best practices such as using asynchronous tasks and using Generics.
It is extremely easy to perform basic validations on request inputs using data annotations such as [Require] and [MaxLength(30)] and we see appropriate responses returned and displayed in Postman.
The next lesson is on Working with Views. In ASP.NET Core these work much like they do in earlier versions of ASP.NET MVC. If you’re not familiar with them yet, you’ll learn everything you need to know about them here.
We also see how to work with databases with EF Core.
Chapter 8 Testing review coming soon
Chapter 9 Clean DDD architecture coming soon
Comparison with courses on Pluralsight
Probably the closest course for comparison on Pluralsight is Scott Allen’s ASP.NET Core 1.0 Fundamentals. However that course is a lot longer at 5 hours 15 minutes, and that is either a good or a bad thing depending on how much time you want to invest.
Shawn Wildermuth’s Building a Web App with ASP.NET Core, MVC 6, EF Core, and Angular has been one of the most popular courses on Pluralsight for a long time now, but I haven’t watched much of it because 9 hours and 33 minutes is too big of a time investment for me.
I like that face that Steve Smith’s course keeps things very simple and sticks to just the stuff that you really need to know. It focuses on understanding the ASP.NET Core technology rather than getting bogged down with everything else needed to write professional applications.
After you’ve watched ASP.NET Core Quick Start you can decide for yourself whether or not you want to dive much deeper.