Build Web Apps with Blazor and ASP.NET Core Web API
Duration
3 days
Description
This course offers a detailed journey into the ASP.NET Core Blazor framework, emphasizing the latest enhancements introduced in .NET 8. Participants will gain proficiency in building sophisticated, composable user interfaces using Razor Components, leveraging the power of Razor syntax for effective data binding and event handling. The curriculum includes hands-on experience with the new QuickGrid component, enabling efficient data display and manipulation. Additionally, learners will explore the intricacies of configuring page routing in Blazor applications and the seamless integration of client-side JavaScript, enriching the functionality and interactivity of their web applications. The course culminates with practical guidance on deploying Blazor applications to production, ensuring participants are equipped with the skills necessary for real-world application development.
Objectives
- Understand the ASP.NET Core Blazor platform including new .NET 8 features
- Build Composable UIs with Razor Components
- Utilize Razor Syntax to Perform Data Binding and Event Handling
- Employ the new QuickGrid Component
- Configure Page Routing with Blazor
- Integrate Client-Side JavaScript with Blazor
- Deploy a Blazor application to production
Prerequisites
Students need HTML, CSS, JavaScript, and C# programming experience.
Training Materials
All students receive comprehensive courseware covering all topics in the course. Courseware is distributed via GitHub in the form of documentation and extensive code samples. Students practice the topics covered through challenging hands-on lab exercises.
Software Requirements
Students will need a free, personal GitHub account to access the courseware. Student will need permission to install Visual Studio 2022 on their computers. Also, students will need permission to install NuGet Packages. If students are unable to configure a local environment, a cloud-based environment can be provided.
Outline
- Introduction
- What is Blazor?
- History of Blazor Hosting Models
- Blazor Server
- Blazor WebAssembly
- Blazor Unified
- Blazor Hybrid
- What's new for Blazor in .NET 8
- Running Blazor Code
- Single Page Applications
- What is WebAssembly?
- Browser Compatibility
- WebAssembly vs. JavaScript
- How does .NET Core / C# run in a web browser?
- Blazor Application
- Project Template
- Create a New Application
- Hosting Blazor with a ASP.NET Core MVC Server
- Configuration
- Dependency Injection
- Environments
- Logging
- Handling Errors
- Debugging WebAssembly in the Browser
- Razor Components and Data Binding
- What is a Component?
- Creating a Data Model
- Binding the Data Model to the HTML
- Passing Arbitrary Attributes
- Handling Events
- Manually Trigger State Updates and Re-rendering
- Rendering
- New .NET 8 Render Modes
- Static Server Rendering
- Interactive Server Rendering
- Interactive WebAssembly Rendering
- Interactive Auto Rendering
- AOT vs. JIT Compilation
- New .NET 8 Output Caching
- New .NET 8 Streaming Rendering
- Render Modes and Consuming Data
- Render Modes and JavaScript
- Composing Razor Components
- Decompose a Component into Smaller Components
- One-Way Data Binding
- Two-Way Data Binding
- Pass Data from a Parent Component to a Child Component using Parameters
- Pass Data from a Child Component to a Parent Component using Event Callbacks
- Use Refs to Access DOM Elements
- Razor Component Libraries
- Razor Component Design Patterns
- Parameters are Immutable
- Lift State Up
- Managing State in General
- New .NET 8 Persistent Component State
- New .NET 8 Section Components
- New .NET 8 QuickGrid Component
- Razor Component Forms
- What is the purpose of Form?
- Collecting Data using a Form, Input, Select, and TextArea Elements
- Explore Form Element Two-Data Binding
- Build Forms with the Blazor Edit Form Razor Component
- Explore the Concept of the Edit Context
- Specialized Edit Form Controls
- Applying Validation to the Form
- Decorating the View Model with Validation Attributes
- Code Custom Validation Attributes
- New .NET 8 Antiforgery Tokens
- Razor Component Pages
- What is the Page model?
- Differences between Razor Pages and Razor Components
- Using a Razor Component as a Page
- Explore the Router Component
- Configuring Page Routing
- Route to Components from Multiple Assemblies
- Using Route Parameters
- Using the Query String
- New .NET 8 Enhanced Navigation for Static Rendered Pages
- Authentication, Authorization, and Auditing
- What is Authentication?
- What is Authorization?
- What is Auditing?
- Authentication Models for Blazor
- Component Attribute-based Authorization
- Authorization Components
- Authorization with C# Code
- Roles and Claims
- New .NET 8 Blazor Identity UI
- Conclusion