
This video will give you an overview about the course.
We need Visual Studio 2019 to work with C# 8 and .NET Core 3.1.
• Download a copy of VS
• Install the VS Community
Read-only Struct members help us in avoiding state mutation.
• Create a new Struct
• Define some fields as private
Default interface methods can help us avoid creating base classes.
• Create an error handling interface
• Update it with a default interface method
We sometimes want to grab a few items from a collection without iterating the whole collection.
• Use Range to grab a subset of items
• Use ^ to indicate elements from the end
• Use open ending Ranges
The null coalescing operator can help us assign values in one line when there is the possibility for null.
• Demonstrate the C# 8 null-coalescing operator
Sometimes complicated switch clauses are hard to write and read because of necessary type checks. Pattern matching can help us in this.
• Prepare the code
• Create a type checking pattern
• Enhance switch cases
We use the “using” keyword to automatically dispose of a disposable resource.
• Add a dispose method to a resource
• Do not implement it
• Add it in a using block
Sometimes you want to create a local function and still be able to access static resources in the class.
• Convert a select callback to an anonymous function
• Have it s access static - level data
• at
Null reference types when enabled can save us from many unexpected NullReferenceExceptions.
• Enable NullRefereceTypes in .csproj
• Demonstrate null reference types
Async streams can be used to fetch remote data one by one.
• Convert an http call to jsonplaceholder’s API into a stream
• Use await foreach to consume a stream
Delegates are function callbacks with predefined signature.
• Create a car class
• Define a delegate
• Invoke the delegate when certain conditions are met
Sometimes you only need a delegate with a few arguments and no return type. Action and function help you define such a thing.
• Handle some delegates with Action
• Handle some delegates with function
Anonymous objects are fast and they preserve the scope.
• Parse async data by creating an anonymous type
Lambdas allow you to quickly create handlers for events without the need of defining a function at the class level.
• Use Lambda functions to handle some of the car class events
• Add arguments to the Lambdas
LINQ allows us to query generic collections with SQL-like syntax.
• Setup a basic LINQ query
• Describe deferred execution
C# supports multi tasking using an event pool and supports multi-threading.
• Create a math solving algorithm on multiple datasets
• Assign the job to threads
• Delegate the thread assignment to a task from the thread pool
We can use attributes on methods and constructors to either mark them with metadata or change their behavior.
• Define a deprecated attribute
• Use it on a service
• Grab all classes marked with attribute from all used assemblies
EF Core can, not only use plain C# class, but can also enhance them with attributes.
• Write a user model
• Flag the primary key
• Use the email and min/max length attributes
One of the strengths of an ORM is to have it store your migrations.
• Install tolling
• Run Add-Migration
• Run Update-Database
One-to-one relationships are the most common types of relationships in SQL.
• Use convention and attributes to define a one to one relationship
• Run the migration
• Inspect SQL Server Object explorer
One-to-many relationships are the second most common.
• Set up the relationship
• Run the migration
• Setup navigation properties
Many to many relationships are a little harder to implement in EF Core but still possible.
• Create the models
• Create the Join Table
• Use the Fluent API
Sometimes we want to be notified about concurrency conflicts.
• Define a timestamp field
• Create and inspect the migration
The startup class is where we register services with the IoC container. It is important to start with this one.
• Explain the startup class
• Demonstrate service registration
Picking up from where we left off in the previous video, we need to examine the different types of scopes available for Dependency Injection.
• Explain Singleton
• Explain Transient
• Explain Request Scope
We need to connect our service layer with business models and Entity Framework Core.
• Add a connection string in appsettings.json
• Connect Entity Framework Core
• Inject EFCore in the service layer
When we use DTOs, we need a fast way to copy fields from and to a DTO.
• Install AutoMapper
• Create a mapping configuration in the startup class
• Use AutoMapper to copy properties from a data transfer object
It’s time to work with the edge of our API, the controller.
• Use Visual Studio to create a new controller
• Describe the methods
Finally, we need authentication and user store.
• Install ASP.NET Core Identity
• Configure EF Core to work with Identity
• Configure and generate JSON Web Tokens
There are two versions of Blazor. The one that uses ASP.NET Core and the other one with web assembly, we need to explain what WebAssembly is.
• Explain Blazor
• Explain WebAssembly
• Start a project
Blazor is fast but we need the large ecosystem of JavaScript libraries.
• Inject JsInterop
• Create an Async JS function
• Call it from code and also import moment
We need to do some real-life work on the application and also style it.
• Add bootstrap
• Style some todos
• Get the value back from the JS function
Razor pages can also be added to existing ASP.NET Core projects not necessarily working with Blazor.
• Enable Razor pages in the startup class
• Map Razor routes in the startup class
• Add a Razor page without a model
Razor pages can also have code behind files.
• Create a new Razor Page with a code behind file
• Add the Page Model
Previous versions of .NET Core weren’t supporting WPF. With .NET Core 3.0 and 3.1, we can build desktop apps using the same technology as with .NET Framework.
XAML is the language of choice for building user interfaces with WPF.
• Add some controls
• Describe the basic containers
• Insert a grid
The grid is perhaps the best container option, so we need to focus on how to utilize it.
• Describe RowDefinitions
• Describe ColumnDefinitions
• Align an item center using a nested grid
The power of WPF lies in its ability to bind properties from C# files to XAML interfaces.
• Add data to backing file
• Create an Item template
• Bind data to the UI
We need to fetch items dynamically.
• Add an event handler on the button
• Trigger Async fetching in the backing file
C# is a multi-paradigm programming language providing support for software engineering principles such as strong type checking, array bound checking, automatic garbage collection, and more. C# 8 comes with a host of new features to build powerful cross-platform applications. Also, ASP.NET Core is the web application framework through which you can develop enterprise-grade web apps.
In this course, you will learn quick and easy ways to develop apps using the latest features of C# 8 and .NET Core 3.1. Kitted out with those skills in your toolset, this course will then help you to make the most of the next sections focusing on advanced C# use cases that are particularly suited to real-world application development.
Moving further, you will get in-depth knowledge of ASP.NET Core 3.1 Web API framework along with authentication methods and Entity Framework Core, the de facto ORM for C# and .NET Core. Finally, you will work with the latest technologies in the .NET Ecosystem, primarily Razor Pages for quickly bootstrapping smart pages and Blazor for building C# apps for the browser. Finally, you will build a desktop application with WPF and .NET Core.
Please note that prior knowledge of C# and some experience with ASP.NET is assumed for taking this course.
About the Author
Dimitris Loukas is a software engineer and is currently part of a growing start-up building a revolutionary referral marketing platform with Node.js, Angular, MySQL, Redis, and Docker. He is also developing trading software applications using C#, Aurelia and TypeScript. He is a Packt author and has developed many video tutorials in C#, .NET Core, and TypeScript. He has worked for two start-ups in the past, is active in the open-source community, and loves taking up small side-projects. He has developed microservices using C# and Node.js and has also mastered Angular, Aurelia, and Vue.js. He is an early adopter of .NET Core and is fascinated by modern JavaScript and where the web is going.