Web Development with Blazor A Practical Guide to Building Interactive UIs with C# 12 And . NET 8
Web Development with Blazor is your essential guide to building and deploying interactive web applications in C# – without relying on JavaScript. Written by an early Blazor adopter and updated for .NET 8, this book takes you through the end-to-end development of an example app, helping you to overco...
Otros Autores: | , |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham, England :
Packt Publishing
[2024]
|
Edición: | Third edition |
Colección: | Expert insight.
|
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009816678006719 |
Tabla de Contenidos:
- Cover
- Copyright
- Foreword
- Contributors
- Table of Contents
- Preface
- Chapter 1: Hello Blazor
- Technical requirements
- Why Blazor?
- Preceding Blazor
- Introducing WebAssembly
- Introducing .NET 8
- Introducing Blazor
- Blazor Server
- Blazor WebAssembly
- Blazor WebAssembly versus Blazor Server
- Blazor Hybrid/.NET MAUI
- Server-Side Rendering (SSR)
- The feature formerly known as Blazor United
- Summary
- Further reading
- Chapter 2: Creating Your First Blazor App
- Technical requirements
- Setting up your development environment
- Windows
- macOS and Linux (or Windows)
- Creating our first Blazor application
- Exploring the templates
- Blazor Web App
- Blazor WebAssembly Standalone App
- Creating a Blazor web application
- Using the command line
- Creating projects using the command line
- Figuring out the project structure
- Program.cs (BlazorWebApp project)
- Program.cs (BlazorWebApp.Client)
- App (BlazorWebApp)
- Routes
- MainLayout
- CSS
- Summary
- Chapter 3: Managing State - Part 1
- Technical requirements
- Creating a data project
- Creating a new project
- Creating data classes
- Creating an interface
- Implementing the interface
- Adding the API to Blazor
- Summary
- Chapter 4: Understanding Basic Blazor Components
- Technical requirements
- Exploring components
- Counter
- Weather
- Learning Razor syntax
- Razor code blocks
- Implicit Razor expressions
- Explicit Razor expressions
- Expression encoding
- Directives
- Adding an attribute
- Adding an interface
- Inheriting
- Generics
- Changing the layout
- Setting a namespace
- Setting a route
- Adding a using statement
- Understanding dependency injection
- Singleton
- Scoped
- Transient
- Injecting the service
- Changing the render mode
- Figuring out where to put the code
- In the Razor file.
- In a partial class
- Inheriting a class
- Only code
- Lifecycle events
- OnInitialized and OnInitializedAsync
- OnParametersSet and OnParametersSetAsync
- OnAfterRender and OnAfterRenderAsync
- ShouldRender
- Parameters
- Cascading parameters
- Writing our first component
- Creating a components library
- Using our components library
- Creating our own component
- Summary
- Chapter 5: Creating Advanced Blazor Components
- Technical requirements
- Exploring binding
- One-way binding
- Two-way binding
- Actions and EventCallback
- Using RenderFragment
- ChildContent
- Default value
- Building an alert component
- Exploring the new built-in components
- Setting the focus of the UI
- Influencing the HTML head
- Component virtualization
- Error boundaries
- Sections
- Summary
- Chapter 6: Building Forms with Validation
- Technical requirements
- Exploring form elements
- EditForm
- InputBase<
- >
- InputCheckbox
- InputDate<
- TValue>
- InputNumber<
- TValue>
- InputSelect<
- TValue>
- InputText
- InputTextArea
- InputRadio
- InputRadioGroup
- InputFile
- Adding validation
- ValidationMessage
- ValidationSummary
- Custom validation class attributes
- Looking at bindings
- Binding to HTML elements
- Binding to components
- Building an admin interface
- Listing and editing categories
- Listing and editing tags
- Listing and editing blog posts
- Adding an abstraction layer
- Locking the navigation
- Enhanced Form Navigation
- Summary
- Chapter 7: Creating an API
- Technical requirements
- Creating the service
- Learning about Minimal APIs
- Adding the API controllers
- Adding APIs for handling blog posts
- Adding APIs for handling Categories
- Adding APIs for handling Tags
- Adding APIs for handling comments
- Creating the client
- Summary.
- Chapter 8: Authentication and Authorization
- Technical requirements
- Setting up authentication
- Configuring our Blazor app
- Securing our Blazor app
- Securing Blazor WebAssembly
- Adding roles
- Configuring Auth0 by adding roles
- Adding roles to Blazor
- Summary
- Chapter 9: Sharing Code and Resources
- Technical requirements
- Adding static files
- Choosing between frameworks
- Adding a new style
- Adding CSS
- Making the admin interface more usable
- Making the menu more useful
- Making the blog look like a blog
- CSS isolation
- Summary
- Chapter 10: JavaScript Interop
- Technical requirements
- Why do we need JavaScript?
- .NET to JavaScript
- Global JavaScript (the old way)
- JavaScript Isolation
- JavaScript to .NET
- Static .NET method call
- Instance method call
- Implementing an existing JavaScript library
- JavaScript interop in WebAssembly
- .NET to JavaScript
- JavaScript to .NET
- Summary
- Chapter 11: Managing State - Part 2
- Technical requirements
- Storing data on the server side
- Storing data in the URL
- Route constraints
- Using a query string
- Implementing browser storage
- Creating an interface
- Implementing Blazor Server (InteractiveServer)
- Implementing WebAssembly (InteractiveWebAssembly)
- Implementing the shared code
- Using an in-memory state container service
- Implementing real-time updates on Blazor Server
- Implementing real-time updates on Blazor WebAssembly
- State management frameworks
- Root-level cascading values
- Summary
- Chapter 12: Debugging the Code
- Technical requirements
- Making things break
- Debugging Blazor Server
- Debugging Blazor WebAssembly
- Debugging Blazor WebAssembly in the web browser
- Hot Reload
- Summary
- Chapter 13: Testing
- Technical requirements
- What is bUnit?
- Setting up a test project
- Mocking the API.
- Writing tests
- Authentication
- Testing JavaScript
- Blazm extension
- Summary
- Chapter 14: Deploying to Production
- Technical requirements
- Continuous delivery options
- Hosting options
- Hosting Blazor Server/InteractiveServer
- Hosting InteractiveWebAssembly
- Hosting Blazor WebAssembly Standalone
- Hosting on IIS
- Summary
- Chapter 15: Moving from, or Combining with, an Existing Site
- Technical requirements
- Introducing web components
- Exploring custom elements
- Exploring the Blazor component
- Adding Blazor to an Angular site
- Adding Blazor to a React site
- Adding Blazor to MVC/Razor Pages
- Adding web components to a Blazor site
- Migrating from Web Forms
- Summary
- Chapter 16: Going Deeper into WebAssembly
- Technical requirements
- Exploring the WebAssembly template
- .NET WebAssembly build tools
- AOT compilation
- WebAssembly Single Instruction, Multiple Data (SIMD)
- Trimming
- Lazy loading
- Progressive web apps
- Native dependencies
- Common problems
- Progress indicators
- Prerendering on the server
- Preloading and persisting the state
- Summary
- Chapter 17: Examining Source Generators
- Technical requirements
- What a source generator is
- How to get started with source generators
- Community projects
- InterfaceGenerator
- Blazorators
- C# source generators
- Roslyn SDK samples
- Microsoft Learn
- Summary
- Chapter 18: Visiting .NET MAUI
- Technical requirements
- What is .NET MAUI?
- Creating a new project
- .NET MAUI App
- .NET MAUI Class Library
- .NET MAUI Blazor Hybrid App
- Looking at the template
- Developing for Android
- Running in an emulator
- Running on a physical device
- Developing for iOS
- Hot restart
- Simulator
- Developing for macOS
- Developing for Windows
- Developing for Tizen
- Summary
- Chapter 19: Where to Go from Here.
- Take-aways from running Blazor in production
- Solving memory problems
- Solving concurrency problems
- Solving errors
- Old browsers
- The next steps
- The community
- The components
- Summary
- Packt Page
- Other Books You May Enjoy
- Index.