ASP.NET Core 5 for Beginners: Kick-start your ASP.NET web development journey with the help of step-by-step tutorials and examples

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Learn how to build web applications efficiently using ASP.NET Core 5 with the C# programming language and related frameworks

Key Features

  • Build web apps and services and cross-platform applications using .NET and C#
  • Understand different web programming concepts with the help of real-world examples
  • Explore the new features and APIs in ASP.NET Core 5, EF Core, Visual Studio, and Blazor

Book Description

ASP.NET Core 5 for Beginners is a comprehensive introduction for those who are new to the framework. This condensed guide takes a practical and engaging approach to cover everything that you need to know to start using ASP.NET Core for building cloud-ready, modern web applications.

The book starts with a brief introduction to the ASP.NET Core framework and highlights the new features in its latest release, ASP.NET Core 5. It then covers the improvements in cross-platform support, the view engines that will help you to understand web development, and the new frontend technologies available with Blazor for building interactive web UIs. As you advance, you'll learn the fundamentals of the different frameworks and capabilities that ship with ASP.NET Core. You'll also get to grips with securing web apps with identity implementation, unit testing, and the latest in containers and cloud-native to deploy them to AWS and Microsoft Azure. Throughout the book, you'll find clear and concise code samples that illustrate each concept along with the strategies and techniques that will help to develop scalable and robust web apps.

By the end of this book, you'll have learned how to leverage ASP.NET Core 5 to build and deploy dynamic websites and services in a variety of real-world scenarios.

What you will learn

  • Explore the new features and APIs introduced in ASP.NET Core 5 and Blazor
  • Put basic ASP.NET Core 5 concepts into practice with the help of clear and simple samples
  • Work with Entity Framework Core and its different workflows to implement your application's data access
  • Discover the different web frameworks that ASP.NET Core 5 offers for building web apps
  • Get to grips with the basics of building RESTful web APIs to work with real data
  • Deploy your web apps in AWS, Azure, and Docker containers
  • Work with SignalR to add real-time notifications to your app

Who this book is for

This book is for developers who want to learn how to develop web-based applications using the ASP.NET Core framework. Familiarity with the C# language and a basic understanding of HTML and CSS is required to get the most out of this book.

Table of Contents

  1. Introduction to ASP.NET Core 5
  2. Cross-Platform Setup
  3. Dependency Injection
  4. Razor View Engine
  5. Getting Started with Blazor
  6. Exploring Blazor Web Frameworks
  7. APIs and Data Access
  8. Identity
  9. Containers
  10. Deploying to AWS and Azure
  11. Debugging and Unit Testing
  12. Integrating with CI/CD
  13. Cloud Native

Author(s): Andreas Helland, Vincent Maverick Durano, Jeffrey Chilberto, Ed Price
Publisher: Packt Publishing
Year: 2020

Language: English
Commentary: True PDF
Pages: 598

Cover
Title Page
Copyright and Credits
Dedication
About Packt
Contributors
Table of Contents
Preface
Section 1 – Crawling
Chapter 01: Introduction to ASP.NET Core 5
Technical requirements
Explaining ASP.NET Core
Managed versus unmanaged code
Introducing the .NET platform
Supportability strategy
Refreshing your C# knowledge
What's new in .NET 5?
What's new in C# 9?
Understanding websites and web servers
Web server configuration
Certificate trust
Session stickiness
Troubleshooting communication with web servers
Choosing a web server option
Exploring Visual Studio Code
Leveraging Windows Terminal
Summary
Questions
Further reading
Chapter 02: Cross-Platform Setup
Technical requirements
Leveraging the .NET framework
Why cross-platform?
Why not cross-platform?
Combining cross-platform and single-platform code
.NET cross-platform availability
What cross-platform does not do for you
Getting started on Windows, Linux, and macOS
Windows
Linux
Windows Subsystem for Linux (WSL)
macOS
A word on cross-platform and containers
Making your code cross-platform
A more complicated cross-platform example
Self-contained .NET apps
Cross-platform for mobile devices
Debugging Linux on Windows with Visual Studio 2019
Summary
Questions
Appendix
Installing your app as a Windows service – the advanced method
Chapter 03: Dependency Injection
Technical requirements
Learning dependency injection in ASP.NET Core
Understanding what DI is
The common dependency problem
Registering the service
Benefits of DI
Reviewing types of dependency injection
Constructor injection
Method injection
Property injection
View injection
Understanding dependency injection containers
Understanding dependency lifetimes
Transient service
Scoped service
Singleton service
Handling complex scenarios
Service descriptors
Add versus TryAdd
Dealing with multiple service implementations
Replacing and removing service registrations
Summary
Questions
Further reading
Chapter 04: Razor View Engine
Technical requirements
Understanding the Razor view engine
Reviewing the Razor view engine
Learning the basics of Razor syntax
Rendering simple data
Rendering data from a view model
Introduction to HTML helpers and tag helpers
Building a to-do application with MVC
Understanding the MVC pattern
Creating an MVC application
Running the app for the first time
Configuring in-memory databases
Creating the to-do controller
Creating a view
Running the to-do app
Implementing add item functionality
Implementing edit functionality
Building a to-do app with Razor Pages
Reviewing Razor Pages
Creating a Razor Pages application
Understanding the Razor Pages structure
Creating the to-do pages
Differences between MVC and Razor Pages
Summary
Further reading
Chapter 05: Getting Started with Blazor
Technical requirements
Understanding the Blazor web framework
Reviewing the different flavors of Blazor
Five players, one goal
Building a tourist spot application
Creating the backend application
Configuring an in-memory database
Implementing real-time functionality with SignalR
Creating the API endpoints
Summary
Questions
Further reading
Section 2 – Walking
Chapter 06: Exploring the Blazor Web Framework
Creating the Blazor Server project
Creating the model
Implementing a service for web API communication
Implementing the application state
Creating Razor components
Running the application
Creating the Blazor Web Assembly project
Creating the model
Composing the Index component
Running the application
Uninstalling the PWA app
Summary
Further reading
Chapter 07: APIs and Data Access
Technical requirements
Understanding Entity Framework Core
Reviewing EF Core design workflows
Learning database-first development
Creating a .NET Core console app
Integrating Entity Framework Core
Creating a database
Generating models from an existing database
Performing basic database operations
Learning code-first development
Reviewing ASP.NET Core Web API
Creating a Web API project
Configuring data access
Managing database migrations
Reviewing DTO classes
Creating Web API endpoints
Summary
Further reading
Chapter 08: Working with Identity in ASP.NET
Technical requirements
Understanding authentication concepts
Base64 encoding
How hashing works
Understanding authorization concepts
The role of middleware in ASP.NET and identity
OAuth and OpenID Connect basics
JSON web tokens
How to generate/issue a token
How to validate a token
Integrating with Azure Active Directory
Understanding single tenancy versus multi-tenancy
Understanding consent and permissions
Working with federated identity
Summary
Questions
Further reading
Chapter 09: Getting Started with Containers
Technical requirements
Hardware virtualization
Overview of containerization
Getting started with Docker
What is Docker?
Installing Docker
Windows Security Alert
Running Redis on Docker
Starting Redis
Running ASP.NET Core in a container
Accessing Redis
Adding container support
Docker multi-container support
Summary
Questions
Further reading
Section 3 – Running
Chapter 10: Deploying to AWS and Azure
Technical requirements
Working with AWS
Working with Azure
GitHub source code
Overview of cloud computing
Cloud computing models
Cloud computing providers
Creating a sample ASP.NET Core web application
Adding a health endpoint
Publishing to AWS
Creating a user for publishing from Visual Studio
Publishing from AWS
Publishing to Azure
Using the Publish wizard in Azure
Azure next steps
Summary
Questions
Further reading
Chapter 11: Browser and Visual Studio Debugging
Technical requirements
Browser
GitHub source
Setting up the sample application
Creating a progressive web application
Saving the state of an application
Understanding PWAs
Accessing browser session and local storage
Using debugging tools in the browser
The Elements tab
The Console tab
The Sources tab
The Network tab
The Application tab
Debugging in Visual Studio
Controlling the application launch and target
Logging activity
Setting a breakpoint
Using conditional breakpoints
Summary
Questions
Further reading
Chapter 12: Integrating with CI/CD
Technical requirements
An overview of CI/CD
Understanding why CI/CD
Introducing GitHub
Is GitHub free?
Some Git terminology
Making a copy of the repo
GitHub support for CI/CD
Building CI/CD using GitHub Actions
What is GitHub Pages?
Creating a CI/CD workflow
Creating a continuous integration job
Creating a continuous deployment job
Monitoring actions
Configuring GitHub Pages
Fixing the base reference
Logging the CI/CD workflow
Next steps with GitHub Actions
Summary
Questions
Further reading
Chapter 13: Developing Cloud-Native Apps
Technical requirements
What makes an application cloud-native?
Comparing characteristics of on-premises versus the cloud
Monolithic versus microservices architecture
Planning for scalability
Working with different database types
Synchronicity and multi-processing tasks
Avoiding failure versus expecting failure
Understanding cloud update schedules
Administration of servers and services
Pets versus cattle
Understanding the role of DevOps
Understanding cost in the cloud
Cloud storage versus local disk
Ephemeral versus persistent storage
Storing and reading files in Azure Blob storage
Dealing with storage latency
Introducing Infrastructure as Code (IaC)
Imperative IaC
Declarative IaC
Learning about monitoring and health
Summary
Questions
Further reading
Assessments
Chapter 1 – Introduction to ASP.NET Core 5
Chapter 2 – Cross-Platform Setup
Chapter 3 – Dependency Injection
Chapter 5 – Getting Started with Blazor
Chapter 8 – Working with Identity in ASP.NET
Chapter 9 – Getting Started with Containers
Chapter 10 – Deploying to AWS and Azure
Chapter 11 – Browser and Visual Studio Debugging
Chapter 12 – Integrating with CI/CD
Chapter 13 – Developing Cloud-Native Apps
Other Books You May Enjoy
Index