Interested in a private company training? Request it here.
In this introduction we will look at how browsers are now capable of running .NET assemblies in the Browser using WebAssembly, .NET and Blazor. Getting hands on is the best way to learn. You will create your first Blazor project in Visual Studio, run the project to see it work, and finally inspect the different aspects of the project to get a “lay of the land” view for how Blazor applications are developed.
Modern web applications use the Model-View-ViewModel approach which heavily relies on data binding. Blazor is no exception! We will look at the different ways to do data binding with Blazor.
Most applications need users to enter some data. So how do we present this to the user, capture changes made and validate the data?
In modern web development we build applications by constructing them from components, which typically are again built from smaller components. A Blazor component is a self-contained chunk of user interface with a single responsibility. Blazor Components are classes built from razor and C# and are easier to understand, debug and maintain. And of course, you can re-use the same component in different pages.
Blazor Components are born, go through changes and get removed. Here we will look at places where you can intercept some of a component's life-cycle.
You can easily distrubute your components as a component libary. This way your components can be used across several Blazor projects. We will also look at developing for both Blazor platforms with the ability to used advanced debugging features.
Dependency Inversion is one of the basic principles of good Object-Oriented design. The big enabler is Dependency Injection. In this chapter we will discuss dependency inversion and injection and why it is a fundamental part of Blazer. We will illustrate this by building a Service that encapsulates where the data gets retrieved and stored.
In general client-side browser applications need to store some of their data. In some cases, such as game apps, the application can store its data in the browser itself, using browser local storage. But in most cases storage will happen on the server which has access to database engines such as SQL Server. In this chapter we will cover the basics of storing data using Entity Framework Core and exposing that data using REST and microservices built on top of ASP.NET Core. Of course Blazor can also work with REST services built on top of other runtimes.
So how do you talk to a REST service with Blazor? We will use the
HttpClient
class you probably already know from other .NET
projects, but with a twist.
Blazor is a .NET framework you use for building Single Page Applications, just like you can use popular JavaScript frameworks such as Angular, React and VueJs. But what is a Single Page Application (SPA)? We will look at using routing to jump between different sections of a SPA and sending data between different components.
Sometimes there is just no escape from using JavaScript 😊. For example, Blazor itself uses JavaScript to update the browser's Document Object Model (DOM) from your Blazor components. You can too. In this chapter we will look at interoperability with JavaScript and, as an example, we will build a Blazor Component Library to display a geographic map.
How can we add authentication to a Blazor application?
Blazor is a new Microsoft Framework for building Single Page Applications. Unlike frameworks such as Angular, VueJS, and React, Blazor allows you to do this using C# and use all the skills and tools you have been using with .NET! Attend this training if you want to get a head-start with Blazor. All examples and labs use the latest LTS version of .NET and Visual Studio. Labs also work with any recent .NET and VS version.
This training requires basic knowledge about building websites with HTML and CSS, and also some knowledge about C# and ASP.NET.