Blazor in Action
- Length: 380 pages
- Edition: 1
- Language: English
- Publisher: Manning
- Publication Date: 2022-07-05
- ISBN-10: 1617298646
- ISBN-13: 9781617298646
- Sales Rank: #724906 (See Top 100 Books)
An example-driven guide to building reusable UI components and web frontends—all with Blazor, C#, and .NET.
Blazor in Action is a practical guide to building stunning UIs and client-side applications using C# and .NET. Written to the most recent stable build of Blazor, this example-driven book shows how to build a complete end-to-end hiking route web application that’s full of easily reusable code.
You’ll create your own custom Blazor components, including handy UI elements like form controls, and learn how to implement access controls and other important security features. Finally, you’ll learn how you can use Blazor components inside your existing ASP.NET applications, and get essential tips and tricks on tuning your app’s performance. By the time you’re done, you’ll be ready to develop beautiful sites and apps that seamlessly execute your C# code natively in the browser.
Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.
inside front cover Blazor in Action Copyright dedication contents front matter preface acknowledgments about this book Who should read this book How this book is organized: A road map About the code liveBook discussion forum about the author about the cover illustration 1 Starting your Blazor journey 1.1 Why choose Blazor for new applications? 1.2 Components, a better way to build UI 1.2.1 What is a component? 1.2.2 The benefits of a component-based UI 1.2.3 Anatomy of a Blazor component 1.3 Blazor, a platform for building modern UIs with C# 1.3.1 Understanding hosting models 1.3.2 Blazor WebAssembly 1.3.3 Blazor Server 1.3.4 Other hosting models Summary 2 Your first Blazor app 2.1 Setting up the application 2.1.1 Blazor WebAssembly template configurations 2.1.2 Creating the application 2.2 Building and running the application 2.3 Key components of a Blazor application 2.3.1 Index.html 2.3.2 Program.cs 2.3.3 App.razor 2.3.4 wwwroot folder and _Imports.razor 2.4 Writing your first components 2.4.1 Organizing files using feature folders 2.4.2 Setting up styling 2.4.3 Defining the layout 2.4.4 The Blazing Trails home page Summary 3 Working with Blazor’s component model 3.1 Structuring components 3.1.1 Single file 3.1.2 Partial class 3.2 Component life cycle methods 3.2.1 The first render 3.2.2 The life cycle with async 3.2.3 Dispose: The extra life cycle method 3.3 Working with parent and child components 3.3.1 Passing values from a parent to a child 3.3.2 Passing data from a child to a parent 3.4 Styling components 3.4.1 Global styling 3.4.2 Scoped styling 3.4.3 Using CSS preprocessors Summary 4 Routing 4.1 Introducing client-side routing 4.1.1 Blazor’s router 4.1.2 Defining page components 4.2 Navigating between pages programmatically 4.3 Passing data between pages using route parameters 4.4 Handling multiple routes with a single component 4.5 Working with query strings 4.5.1 Setting query-string values 4.5.2 Retrieving query-string values using SupplyParameterFromQuery Summary 5 Forms and validation—Part 1: Fundamentals 5.1 Super-charging forms with components 5.1.1 Creating the model 5.1.2 Basic EditForm configuration 5.1.3 Collecting data with input components 5.1.4 Creating inputs on demand 5.2 Validating the model 5.2.1 Configuring validation rules with Fluent Validation 5.2.2 Configuring Blazor to use Fluent Validation 5.3 Submitting data to the server 5.3.1 Adding MediatR to the Blazor project 5.3.2 Creating a request and handler to post the form data to the API 5.3.3 Setting up the endpoint Summary 6 Forms and validation—Part 2: Beyond the basics 6.1 Customizing validation CSS classes 6.1.1 Creating a FieldCssClassProvider 6.1.2 Using custom FieldCssClassProviders with EditForm 6.2 Building custom input components with InputBase 6.2.1 Inheriting from InputBase<T> 6.2.2 Styling the custom component 6.2.3 Using the custom input component 6.3 Working with files 6.3.1 Configuring the InputFile component 6.3.2 Uploading files when the form is submitted 6.4 Updating the form to allow editing 6.4.1 Separating the trail form into a standalone component 6.4.2 Refactoring AddTrailPage.razor 6.4.3 Adding the edit trail feature 6.4.4 Testing the edit functionality Summary 7 Creating more reusable components 7.1 Defining templates 7.2 Enhancing templates with generics 7.3 Sharing components with Razor class libraries Summary 8 Integrating with JavaScript libraries 8.1 Creating a JavaScript module and accessing it via a component 8.1.1 Testing out the RouteMap component 8.1.2 Calling JavaScript functions from C# and returning a response 8.2 Calling C# methods from JavaScript 8.3 Integrating the RouteMap component with the TrailForm 8.4 Displaying the RouteMap on the TrailDetails drawer Summary 9 Securing Blazor applications 9.1 Integrating with an identity provider: Auth0 9.1.1 Registering applications with Auth0 9.1.2 Customizing tokens from Auth0 9.1.3 Configuring Blazor WebAssembly to use Auth0 9.1.4 Configuring ASP.NET Core WebAPI to use Auth0 9.2 Displaying different UI fragments based on authentication status 9.2.1 Updating the Home feature 9.3 Prevent unauthorized users accessing a page 9.3.1 Securing API endpoints 9.3.2 Calling secure API endpoints from Blazor 9.4 Authorizing users by role 9.4.1 Adding roles in Auth0 9.4.2 Consuming Auth0 roles in Blazor WebAssembly 9.4.3 Implementing role-based logic Summary 10 Managing state 10.1 Simple state management using an in-memory store 10.1.1 Creating and registering a state store 10.1.2 Saving data entered on the form to AppState 10.2 Improving the AppState design to handle more state 10.3 Creating persistent state with browser local storage 10.3.1 Defining an additional state store 10.3.2 Adding and removing trails from thefavorites list 10.3.3 Displaying the current number of favorite trails 10.3.4 Reorganizing and refactoring 10.3.5 Showing favorited trails on the favorite trails page 10.3.6 Initializing AppState Summary 11 Testing your Blazor application 11.1 Introducing bUnit 11.2 Adding a bUnit test project 11.3 Testing components with bUnit 11.3.1 Testing rendered markup 11.3.2 Triggering event handlers 11.3.3 Faking authentication and authorization 11.3.4 Emulating JavaScript interactions 11.3.5 Testing multiple components Summary Appendix A. Adding an ASP.NET Core backend to a Blazor WebAssembly app A.1 Adding an ASP.NET Core Web API A.1.1 Removing boilerplate from the new API project A.1.2 Configuring the API A.2 Adding a .NET class library to share code between client and API A.3 Setting up an SQLite database in the API A.3.1 Configuring the initial entities for the system A.3.2 Setting up the database context A.3.3 Connection strings and service configuration A.3.4 Creating the first migration and creating the database Appendix B. Updating existing areas to use the API B.1 Creating a new API endpoint that returns all trails B.2 Updating the Home feature to load trail data from the API B.2.1 Adding the GetTrailsHandler class B.2.2 Updating HomePage.razor and SearchPage.razor to use GetTrailRequest via MediatR B.2.3 Updating TrailCard.razor and TrailDetails.razor index
Donate to keep this site alive
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.