Learning Blazor: Build Single-Page Apps with WebAssembly and C#
- Length: 300 pages
- Edition: 1
- Language: English
- Publisher: O'Reilly Media
- Publication Date: 2022-11-08
- ISBN-10: 1098113241
- ISBN-13: 9781098113247
- Sales Rank: #406010 (See Top 100 Books)
Take advantage of your C# skills to build UI components and client-side experiences with .NET. With this practical guide, you’ll learn how to use Blazor WebAssembly to develop next-generation web experiences. Built on top of ASP.NET Core, Blazor represents the future of .NET single-page applications (SPA) investments.
Author David Pine, who focuses on .NET and Azure content development at Microsoft, explains how WebAssembly enables many non-JavaScript-based programming languages to run on the client browser. In this book, you’ll learn about real-time web functionality with ASP.NET Core SignalR. You’ll learn strategies for bidirectional JavaScript interop. David covers component data binding, hierarchical event-driven communications, in-memory state management, and local storage.
This book shows you how to:
- Create a feature-rich Blazor app that looks beautiful
- Localize an enterprise-scale app as the sole developer using GitHub Actions and Azure Cognitive Services Translator service
- Create advanced validation scenarios for input-based components with forms
- Automatically deploy and host to Azure Static Web Apps, and rely on HTTP services
- Utilize geolocation service native to the browser, as well as native speech synthesis and recognition
- Author a custom modal verification mechanism for validating a user
- Determine the best approach for building reliable, architecturally sound websites
Foreword Preface Why Blazor? Who Should Read This Book For .NET Developers For Web Developers Why I Wrote This Book How to Use This Book Roadmap and Goals of This Book Conventions Used in This Book Using Code Examples O’Reilly Online Learning How to Contact Us Acknowledgments 1. Blazing into Blazor The Origin of Blazor Blazor Hosting Blazor Server Blazor WebAssembly Blazor Hybrid Single-Page Applications, Redefined Why Adopt Blazor .NET’s Potential in the Browser .NET Is Here to Stay Familiarity Safe and Secure Code Reuse Tooling Open Source Software Your First Blazor App with the .NET CLI Build the App Install Dev-cert Run the App The Code Must Live On Perusing the “Learning Blazor” Sample App Summary 2. Executing the App Requesting the Initial Page App Startup and Bootstrapping Blazor WebAssembly App Internals Detecting Client Culture at Startup Layouts, Shared Components, and Navigation Blazor navigation essentials The Router Redirect to login when unauthenticated Blazor component lifecycle The MainLayout component The custom NavBar component The header and footer components An in-memory app state model Understanding the LoginDisplay component Native theme awareness Summary 3. Componentizing Design with the User in Mind Leveraging “Pwned” Functionality “Have I Been Pwned” Client Services Restricting Access to Resources The Introduction Component Says “Hi” The Joke Component and Services Aggregating Joke Services—Laughter Ensues DI from Library Authors Forecasting Local Weather Summary 4. Customizing the User Login Experience A Bit More on Blazor Authentication Client-Side Custom Authorization Message Handler Implementation Customizing the client’s authorization experience The Web.Client ConfigureServices Functionality Native Speech Synthesis Sharing and Consuming Custom Components Chrome: The Overloaded Term Modal Modularity and Blazor Component Hierarchies Exploring Blazor Event Binding Summary 5. Localizing the App What Is Localization? The Localization Process The Language Selection Component Automating Translations with GitHub Actions Localization in Action Summary 6. Exemplifying Real-Time Web Functionality Defining the Server-Side Events Exposing Twitter Streams and Chat Functionality Writing Contextual RPC and Inner-Process Communication Configuring the Hub Endpoint Consuming Real-Time Data on the Client Configuring the Client Sharing a Hub Connection Shared hub connection authentication Shared hub connection initiation Shared hub connection chat Shared hub connection tweets Consuming Real-Time Data in Components Summary 7. Using Source Generators What Are Source Generators? Building a Case for Source Generators C# Source Generators in Action Source Generating the localStorage API Source Generating the Geolocation API Example Usage of the ILocalStorageService Summary 8. Accepting Form Input with Validation The Basics of Form Submission Framework-Provided Components for Forms Models and Data Annotations Defining Component Models Defining and Consuming Validation Attributes Implementing a Contact Form Implementing Speech Recognition as User Input Reactive Programming with the Observer Pattern Managing Callbacks with a Registry Applying the Speech Recognition Service to Components Form Submission Validation and Verification Summary 9. Testing All the Things Why Test? Unit Testing Defining Unit-Testable Code Writing an Extension Method Unit Test Component Testing End-to-End Testing with Playwright Automating Test Execution Summary A. Learning Blazor App Projects Web Client Web API Pwned Web API Web Abstractions Web Extensions Web HTTP Extensions Web Functions Web Joke Services Web Models Web Twitter Components Web Twitter Services Index
Donate to keep this site alive
How to download source code?
1. Go to: https://www.oreilly.com/
2. Search the book title: Learning Blazor: Build Single-Page Apps with WebAssembly and C#
, sometime you may not get the results, please search the main title
3. Click the book title in the search results
3. Publisher resources
section, click Download Example Code
.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.