Building a Web App with Blazor and ASP .Net Core: Create a Single Page App with Blazor Server and Entity Framework Core
- Length: 218 pages
- Edition: 1
- Language: English
- Publisher: BPB Publications
- Publication Date: 2020-07-16
- ISBN-10: 9389845459
- ISBN-13: 9789389845457
- Sales Rank: #3801202 (See Top 100 Books)
Learn how to create and deploy a SPA in C# with Blazor
Key Features
- Get familiar with the basic and advanced concepts of the Blazor framework
- Understand how to implement JavaScript interop in Blazor
- Learn how to inject the service dependency in Blazor
- Learn how to implement security using Authentication and authorization
- Deploy and host your Blazor app on IIS and Azure
Description
Blazor is a new, open-source, and SPA web framework that allows you to build a web application using C# and HTML. Blazor enables you to write C# code instead of JavaScript.
This book is a comprehensive guide about the new modern Blazor framework. It begins with an introduction to the Blazor and its components and concepts. It explains how you can start the development process, what tools you can use to develop an application, and how you can deploy it. You will then learn more about Databind, Eventbinding, layout, routing, JavaScript interop, and Dependency Injection. Concepts such as Authentication and authorization, error handling are also covered. Towards the end, you will learn how to deploy your Single Page Application Using Blazor.
What will you learn
- Explore and use a various way to create a Blazor component
- Get familiar with the working of Data Binding, Event Binding, Layouts, Routing, and Validation
- Learn how to invoke JavaScript functions from .NET methods
- Preserving State in Server-Side Blazor applications
- Authentication and Authorization using Facebook API & Google API
- Host and Deploy your Blazo app on IIS and Azure
Who this book is for
This book is for web developers who want to use Blazor to build web apps. This book will also help and guide web developers who are currently using Blazor.
Cover Page Title Page Copyright Page Dedication About the Author About the Reviewer Acknowledgement Preface Errata Table of Contents 1. An Introduction to Blazor Introduction Objectives What is Web Assembly? Security considerations WebAssembly limitations Facts about WebAssembly Is WASM kill JavaScript? Is WASM a new programming language? Can other programming languages write WASM code other than C and Rust? Is it an upgraded version of Silverlight? What is Blazor? Interpreted mode Ahead-of-time compiled mode Features of Blazor Blazor (client) supported platforms Prerequisite Blazor development .NET Core Framework (.NET Core SDK) Integrated Development Environment - IDE Creating first Blazor application Creating a project with Visual Studio 2019 Creating a project using dotnet CLI Understand project structure and component Understand Blazor booting process Render tree in Blazor application Blazor client-side Blazor server side Summary What did you learn in this chapter? What next? Questions 2. Components and Structure for Blazor Applications Introduction Objectives What is the Blazor component? Create Blazor component Using a single file - inline Component with code behind Class only component Life Cycle methods of component OnInitialized and OnInitializedAsync OnParametersSet and OnParametersSetAsync OnAfterRender and OnAfterRenderAsync SetParametersAsync StateHasChanged Dispose component with IDisposable Component parameters Child component Templated components Grid view template example List view template example Define template inline - using Razor template syntax Cascading values Declaring HTML attributes using parameters Import components Summary What did you learn in this chapter? What next? Questions 3. Blazor Concepts Introduction Objectives Data Binding One-way data binding Two-way data binding Event Binding Event Callback Layouts Introduction to Layouts page Specify a layout in a component Define layout globally Nested layouts Example Routing @page directive/route attribute Example Route parameters Route constraints Example Programmatically navigate one component to another component Query parameters Forms and validation Data annotations Summary What do you learn in this chapter? What is next? Questions 4. Dependency Injection Introduction Objective Types of dependency injection Construction injection Setter injection Interface based injection Service lifetime Scoped Singleton Transient Add services to the application Default services Inject the service in the component Example of adding service as a dependency Use dependency in services Using OwningComponentBase Summary What you learned in this chapter? What next? Questions 5. JavaScript Interop Introduction Objective What is JavaScript Interop? Invoke JavaScript functions from C# (.NET) methods Invoke C# (.NET) methods from JavaScript Capture references to elements Detect when a Blazor app is pre-rendering Share interop code in a class library Summary What you learned in this chapter? What next? Questions 6. State Management Introduction Objectives Understand Blazor circuits Preserve state across circuits Where to persist state On server in database On client in the browser URL Third-party browser storage solutions Summary What you learned in this chapter? What next? Questions 7. Authentication and Authorization Introduction Objective Authentication AuthenticationStateProvider service Custom AuthenticationStateProvider Authorization AuthorizeView Authorize attribute Custom content for unauthorized router component Authorization rules check-in procedural logic Authorization in Blazor client-side apps Authentication using third party service Using Microsoft API Using Google API Using Facebook API Use multiple authentication providers together Summary What you learned in this chapter? What next? Questions 8. Handle Exception and Log Error Introduction Objective The behavior of Blazor app for an unhandled exception Places where errors may occur Component instantiation Lifecycle methods Rendering logic Component disposal JavaScript interop Event handlers Circuit handlers and disposal Prerendering Enabling detailed errors Introduction to the logging framework Configure logging provider Set default minimum log level Logging using serilog Write log to file using serilog Summary What you learned in this chapter? What next? Questions 9. Getting Started with Blazor Using Visual Studio 2019 Introduction Objective Setting up the Blazor development environment using Visual Studio 2019 Creating a single page application using Blazor Scaffolding the model using EF Core CRUD operation with EF in Blazor server app Create Add/Edit page with validation Delete customer Installed project template for Blazor Summary What you learned in this chapter? What next? Questions 10. Hosting and Deployment Introduction Objective Publish Blazor server app Deploying Blazor app on IIS Prerequisites Configure IIS Deploying Blazor app on Azure Prerequisites Deploy app on Azure as app service Create publish profile with create app service or selecting existing one Sign in using Azure account Configure App Service. Publish application on app service Create database server and database on Azure Login to Azure portal and select SQL databases from the left menu Create a database Get connection string Configure firewall for SQL server Summary What you learned in this chapter? Questions
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.