.NET 6 introduction
.NET 6 is the main implementation of .NET going forward.
- What and Why
- Understanding .NET 6: .NET Framework versus .NET 5
- Supporting multiple runtimes
- What is .NET Standard?
Visual Studio for ASP.NET Core
So what is new in Visual Studio for .NET 6 and ASP.NET Core?
- Visual Studio 2022
- Developing with the new Hot Reload
- Creating your own NuGet packages with .NET Core
- Pinning the .NET SDK with global.json
Modern C# Language Features You Need to Know
.NET 6 now uses C# 10, which contains many exiting new language features you need to knowledge to build better software with .NET 6.
- Nullable Reference Types
- Implicit Usings and File Scoped Namespaces
- Value Tuples
- C# Pattern Matching
- Init-only Properties and Records
- Target Typed Expressions
- Top-level Programs
ASP.NET Core Configuration
ASP.NET Core allows you to pick and choose where to store your configuration. No more deploying web.config with production settings in source control! We will look at the idea behind this and of course how to choose your ideal configuration.
- Different ways of getting configuration to your code
- Storing sensitive configuration in Secrets
- Adding your own configuration provider
Proper logging is essential to find problems while developing and in production. .NET 6 brings a unified logging approach which you can use anywhere in .NET and also works with your preferred logging framework such as NLog.
- Why do we need another logging framework?
- Choosing from different logging providers
- Understanding logging scopes
- Using the HTTP Logging Middleware
- An example: Using NLog with .NET Core 6
Building Custom Middleware for ASP.NET Core 6
The Open Web Interface for .NET brought a simple standard way for building web servers with .NET. ASP.NET Core built upon this standard and with it you can easily build your own custom extensions.
- Understanding the principle of the ASP.NET Core Pipeline
- Building your own custom middleware
- Testing your middleware
- LAB: Building a custom middleware class and testing it
ASP.NET Core MVC in .NET 6
- Using CSS Isolation for MVC Views
- Building Custom TagHelpers
- Understanding and Creating View Components
- Using Worker Services to execute jobs in the background
- LAB: Creating your own tag helper and view component
ASP.NET Core with .NET 6
With .NET 6 we get a new model for building websites: Minimal API. This does change some of the ways you work with ASP.NET Core.
- Building websites with minimal API
- Changes in Dependency Injection
- Defining routes and handlers for minimal API
- Understanding Model Binding
- Creating Custom Model Bindings
- Working with Validation
- Integration with Angular and React
Working with JSON
Making REST calls requires knowledge of JSON and serialization. Here we will look at some of the new JSON serialization features in .NET 6.
- The new JsonSerializer
- Using the new convenience extension methods
- Using IHttpClientFactory to maximize re-use
Publishing Your Application
So you have finished a working version of your application. How do you deploy this? What are the options? Since .NET is cross-platform, you can build everything on Windows, and then run on Linux. You could even deploy your application to a Docker container! We will also discuss various deployment options, such as assembly trimming.
- Deployment Options
- Cross-platform Deployment
- Self-Contained Deployment
- Optimize your deployment with Assembly Trimming
- Deploying to Containers
Entity Framework Core
With .NET 6 also comes a whole new Entity Framework Core. A new implementation of EF, which can run cross-platform, on Windows, Mac and Linux.
- Differences with .NET 4.x Entity Framework
- Scaffolding your project from an existing database
- Understanding the generated code
- Interacting with the database with LINQ
- LAB: Scaffolding your model from an existing database
Modeling your database with EF Core
Mapping in EF Core uses conventions, attributes, or Fluent API. You will see how to use these to model your database in EF Core and apply the changes with Code-first Migrations.
- Methods of configuration
- Creating and applying migrations
- Table and column mapping
- Modeling properties
- Mapping Value generated properties
- Handling Concurrent updates
- Modeling relationships
- Mapping inheritance
- LAB: Modelling a database with EF Core
Add real-time web functionality to your application.
- What is SignalR?
- Server Concepts
- LAB: Building an emergency dashboard with SignalR
Efficient Communication with gRPC
With gRPC you can setup efficient communication between two parties using modern Remote Procedure Call.
- What is gRPC?
- Defining your contracts
- Implementing your contracts on the server
- Generating a Proxy and using it on the client
Building Singe Page Applications with C# and Blazor
- Introducing Blazor and Web Assembly
- Client-Side vs. Server-Side Blazor
- Creating a simple Blazor Component
- Hosting Blazor
- LAB: Building a simple Blazor application
Azure App Services: Web Apps
So you want to host your web site. But what about scalability, fault-tolerance, HTTPS and other things? The cloud can make this a lot easier for you.
- Deploying from Visual Studio
- Configuring app settings, TLS, domain names and backup scheduling
- Monitoring your Web Api
- LAB: Manually deploying your web site and database in Azure App Services
Source Control with GitHub
Sources are probably the most important part in any software project and we need a way to keep track of all sources and all changes. Here you will learn to use Git(Hub) to store the your project safely.
- Distributed Source Control with Git and GitHub
- Creating a local repository
- Staging and committing files
- Branching, Merge vs. Rebase
- Synchronizing with a remote repository
- Pull Requests
- LAB: Working with Git and GitHub
Continuous Integration with GitHub Actions
To build quality software, and to limit nasty integration problems at the end of the project, doing a daily build is long regarded as a best practice. GitHub Actions makes building daily very easy through workflows. You’ll learn how to manage the build, do desktop and web builds, and how you can setup a continuous integration environment. You’ll then learn how to customize the build process to perform all your build steps including running unit tests, and deploying to staging servers.
- What is GitHub Actions?
- Doing Continuous integration
- What are jobs and steps?
- Integrating with Azure using Publish Profiles or Service Principals
- LAB: Deploying a web site to an Azure WebApp using Github actions
Understanding Claims-Based Security
So what will you allow your user to do? This most-likely depends on the role the user has in your organisation. This role is now represented with claims. In this chapter you will get a better understanding why claims are better than roles, and how claims are transmitted in a secure way as tokens.
- Representing the user
- Introducing claims based security
- Understanding tokens and their representation on the net
- Using Claims in .NET
- LAB: Authenticating a web site with claims
Modern web authentication and authorization
In the modern web we all want to share stuff. But how do you safely allow one web site to access resources from another web site? With OpenID Connect you can delegate authentication to an identity provider (such as Facebook, Azure AD, Identity Server and others).
- The Internet and a way of sharing
- Introducing OAuth and OpenID Connect
- OAuth fundamentals: Authorization Code Grant, Implicit Grant and Client Credential Grant
- Implementing OpenID Connect web sign-in with AzureAD and Identity Server
- LAB: Protecting your ASP.NET Core site with OpenID Connect
Protecting a Web-API with OAuth
Modern web sites and mobile appls consume REST services. You can use OpenID Connect to authenticate users, after which you can use claims to authorize resources stored in a web API.
- Protecting a Web API’s resources
- Adding permissions to the server side
- Requesting permissions at the client side
- Using the Microsoft Authentication Library (MSAL)
- User consent
- LAB: Getting an access token and passing it to the server
Architecting Modern Web Applications
So what is a modern web application? One that uses Angular and TypeScript? With the speed that modern web application development evolves, there is the chance that your web site uses ‘old’ technology by the time it is done. But sound architecture never goes stale. As a wise man once said: ‘If you think good architecture is expensive, try bad architecure’.
- “Clean” Architecture: put the business and application model at the center
- Understanding the Core, Infrastructure and Presentation layers
- Testing everything with Clean Architecture
- LAB: Creating the structure for a web site with clean architecture
The world is a big place, with many spoken languages. If you want to reach the world, you should build multi-language support in from the beginning.
- Display Content in Different Cultures
- Using resource files
- Autodetect Cultures
- LAB: Adding language support to an ASP.NET Core web site