Introduction to WebAssembly and Blazor
In this introduction we will look at how browsers are now capable of running .NET assemblies in the Browser
using WebAssembly, Mono and Blazor. Getting hands on is the best way to learn. You’ll install the prerequisites
to develop with Blazor. Then you’ll 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
- Building Rich Web Experiences, Past, Present and Future
- Introducing Web Assembly.
- Web Assembly and Mono.
- Getting Started with Blazor – Easy!
- Client Side vs. Server Side Blazor.
- Blazor Features Overview.
- Installing Blazor Prerequisites.
- Generating your project with Visual Studio or Code.
- Examining the solutions and its projects.
Blazor Data Binding
Modern web applications use the Model-View-ViewModel approach which heavily relies on data binding. Blazor
is no exception. Here we will look at the different ways to do data binding with Blazor.
- A Quick Look at Razor.
- One Way Data Binding.
- Event Handling and Data Binding.
- Two Way Data Binding.
- Reporting Changes.
- Forms and Validation.
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. Blazor Components are classes built from razor
and C# with one specific purpose (also known as the principle of Single Responsibility)
and are easier to understand, debug and maintain. And of course, you can use the same component in different pages.
- What is a Blazor Component?
- Building a Simple Blazor Component.
- Component Parameters.
- Conditional Rendering and ChildContent.
- Separating the View and View-Model.
- Component Data Binding.
- Attribute Splatting.
- Understanding EventCallback.
- Referring to Components.
- Building a Component Library.
- Styling Components.
- Lifecycle Hooks.
Services and Dependency Injection.
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.
- Understanding Dependency Inversion & Injection.
- Some Inversion of Control Containers.
- Constructor & Property Injection.
- Configuring Dependency Injection.
- Blazor and Dependency Injection.
- Building Blazor Services.
Data Storage and Microservices
In general client-side browser applications need to store some of their data.
In some cases, such as games, 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.
- What is REST?
- Invoking Server Functionality with REST.
- Building a Simple Microservice with ASP.NET Core.
- What is Entity Framework Core?
- Generating the Database with Code First.
- Testing your Microservice.
Communication with Microservices
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.
- Sending and receiving data.
- Using the HttpClient Class.
- The HttpClientJSONExtensions Methods.
- Taking full control with HttpRequestMessage.
- Retrieving Data From the Server.
- Storing Changes.
Single Page Applications and Routing.
Blazor is a .NET framework you use for building Single Page Applications,
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.
- What is a Single Page Application?
- Using Layout Components.
- Understanding Routing.
- Setting the Route Template.
- Redirecting to Other Pages.
- Sharing State between Components.
we will build a Blazor Component Library to display a line chart, using a popular open-source
Blazor is a new Microsoft Framework for building Single Page Applications. Unlike frameworks like Angular and React Blazor
allows you to do this using C# and the .NET framework! Attend this training if you want to get a head-start with Blazor.
This training requires basic knowledge about building websites with HTML and CSS,
and also some knowledge about C# and ASP.NET.