Web Development with Blazor - Second Edition: An in-depth practical guide for .NET developers to build interactive UIs with C#

Engström, Jimmy

  • 出版商: Packt Publishing
  • 出版日期: 2023-03-16
  • 售價: $1,640
  • 貴賓價: 9.5$1,558
  • 語言: 英文
  • 頁數: 360
  • 裝訂: Quality Paper - also called trade paper
  • ISBN: 1803241497
  • ISBN-13: 9781803241494
  • 相關分類: .NETC#
  • 海外代購書籍(需單獨結帳)



Develop modern web UIs with Blazor Server and Blazor WebAssembly

Key Features

• Create a production-ready Blazor application from start to finish
• Learn Blazor fundamentals, gain actionable insights, and discover best practices
• Find out how, when, and why to use Blazor Server and Blazor WebAssembly, as well as Blazor Hybrid

Book Description

Blazor is an essential tool if you want to build interactive web apps without JavaScript, but it has a learning curve. Updated with the latest code in .NET 7 and C# 11 and written by someone who adopted Blazor early, this book will help you overcome the challenges associated with being a beginner with Blazor and teach you the best coding practices.

You'll start by learning how to leverage the power of Blazor and exploring the full capabilities of both Blazor Server and Blazor WebAssembly. Then you'll move on to the practical part, centered around a sample project – a blog engine. You'll apply all your newfound knowledge about creating Blazor projects, the inner workings of Razor syntax, validating forms, and creating your own components.

This new edition also looks at source generators, dives deeper into Blazor WebAssembly with ahead-of-time, and includes a dedicated new chapter demonstrating how to move components of an existing JavaScript (Angular, React) or MVC-based website to Blazor or combine the two. You'll also see how to use Blazor (Hybrid) together with .NET MAUI to create cross-platform desktop and mobile applications.

When you reach the end of this book, you'll have the confidence you need to create and deploy production-ready Blazor applications, and you'll have a big-picture view of the Blazor landscape.

What you will learn

• Understand the different technologies that can be used with Blazor, such as Blazor Server, Blazor WebAssembly, and Blazor Hybrid
• Find out how to build simple and advanced Blazor components
• Explore the differences between Blazor Server and Blazor WebAssembly projects
• Discover how Minimal APIs work and build your own API
• Explore existing JavaScript libraries in Blazor and JavaScript interoperability
• Learn techniques to debug your Blazor Server and Blazor WebAssembly applications
• Test Blazor components using bUnit

Who this book is for

This book is for .NET web developers and software developers who want to use their existing C# skills to build interactive SPA applications running either inside the web browser using Blazor WebAssembly, or on the server using Blazor Server.

You'll need intermediate-level web-development skills, basic knowledge of C#, and prior exposure to .NET web development before you get started; the book will guide you through the rest.


使用 Blazor Server 和 Blazor WebAssembly 開發現代網頁 UI


- 從頭到尾建立一個可投入生產的 Blazor 應用程式
- 學習 Blazor 基礎知識,獲得可行的見解,並發現最佳實踐方法
- 了解何時以及為何使用 Blazor Server 和 Blazor WebAssembly,以及 Blazor Hybrid


Blazor 是一個重要的工具,如果你想要建立互動式的網頁應用程式而不使用 JavaScript,但它有一定的學習曲線。這本書使用最新的 .NET 7 和 C# 11 代碼,由一位早期採用 Blazor 的人撰寫,將幫助您克服初學者在 Blazor 上遇到的挑戰,並教授最佳的編碼實踐方法。

您將首先學習如何利用 Blazor 的強大功能,並探索 Blazor Server 和 Blazor WebAssembly 的全部能力。然後,您將進入實踐部分,圍繞著一個示例項目 - 一個部落格引擎。您將應用所有新學到的關於創建 Blazor 項目、Razor 語法的內部運作、驗證表單和創建自己的組件的知識。

這個新版本還介紹了源代碼生成器,更深入地研究了 Blazor WebAssembly 的預先編譯,並包含了一個專門的新章節,演示如何將現有 JavaScript (Angular、React) 或基於 MVC 的網站的組件移植到 Blazor 或結合兩者。您還將看到如何使用 Blazor (Hybrid) 與 .NET MAUI 一起創建跨平台的桌面和移動應用程式。

當您完成本書時,您將具備創建和部署可投入生產的 Blazor 應用程式所需的信心,並對 Blazor 領域有一個整體的了解。


- 了解可以與 Blazor 一起使用的不同技術,如 Blazor Server、Blazor WebAssembly 和 Blazor Hybrid
- 發現如何構建簡單和高級的 Blazor 組件
- 探索 Blazor Server 和 Blazor WebAssembly 項目之間的差異
- 了解 Minimal APIs 的工作原理並建立自己的 API
- 在 Blazor 中使用現有的 JavaScript 函式庫和 JavaScript 互操作性
- 學習調試 Blazor Server 和 Blazor WebAssembly 應用程式的技巧
- 使用 bUnit 測試 Blazor 組件


本書適用於 .NET 網頁開發人員和軟體開發人員,他們希望利用現有的 C# 技能來建立在網頁瀏覽器中運行的互動式 SPA 應用程式,使用 Blazor WebAssembly,或者在伺服器上使用 Blazor Server。

您需要具備中級網頁開發技能、基本的 C# 知識以及之前接觸過 .NET 網頁開發;本書將引導您完成其餘的部分。


1. Hello Blazor
2. Creating Your First Blazor App
3. Managing State – Part 1
4. Understanding Basic Blazor Components
5. Creating Advanced Blazor Components
6. Building Forms with Validation
7. Creating an API
8. Authentication and Authorization
9. Sharing Code and Resources
10. JavaScript Interop
11. Managing State Part 2
12. Debugging the Code
13. Testing
14. Deploy to Production
15.  Moving from, or Combining, an Existing Site
16. Going Deeper into WebAssembly
17. Examining Source Generators
18. Visiting .NET MAUI
19. Where to Go from Here


1. 嗨,Blazor
2. 建立你的第一個 Blazor 應用程式
3. 管理狀態 - 第一部分
4. 了解基本的 Blazor 元件
5. 建立進階的 Blazor 元件
6. 使用驗證建立表單
7. 建立 API
8. 認證與授權
9. 共享程式碼和資源
10. JavaScript 互操作
11. 管理狀態 - 第二部分
12. 偵錯程式碼
13. 測試
14. 部署到生產環境
15. 從現有網站遷移或結合
16. 深入研究 WebAssembly
17. 檢視 Source Generators
18. 探索 .NET MAUI
19. 從這裡出發的下一步去向