ASP.NET Core 5 for Beginners
eBook - ePub

ASP.NET Core 5 for Beginners

Kick-start your ASP.NET web development journey with the help of step-by-step tutorials and examples

Andreas Helland, Vincent Maverick Durano, Jeffrey Chilberto, Ed Price

Condividi libro
  1. 598 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

ASP.NET Core 5 for Beginners

Kick-start your ASP.NET web development journey with the help of step-by-step tutorials and examples

Andreas Helland, Vincent Maverick Durano, Jeffrey Chilberto, Ed Price

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

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.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
ASP.NET Core 5 for Beginners è disponibile online in formato PDF/ePub?
Sì, puoi accedere a ASP.NET Core 5 for Beginners di Andreas Helland, Vincent Maverick Durano, Jeffrey Chilberto, Ed Price in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Computer Science e Programming in C#. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2020
ISBN
9781800566316
Edizione
1

Section 1 – Crawling

In this section, you will learn the basics of .NET Core 5, including an overview, goals/values, new features, and its history. We’ll also help you refresh your C# skills, and we’ll cover setting up your cross-platform environment, as well as building apps and pages with CSHTML, MVC, Razor Pages, and Blazor (by using a unified markup engine—Razor). Finally, we’ll explain the dependency injection software design pattern.
This section includes the following chapters:
  • Chapter 1, Introduction to ASP.NET Core 5
  • Chapter 2, Cross-Platform Setup
  • Chapter 3, Dependency Injection
  • Chapter 4, Razor View Engine
  • Chapter 5, Getting Started with Blazor

Chapter 1: Introduction to ASP.NET Core 5

.NET 5 is the latest and greatest in the .NET platform. .NET 5 is the successor of .NET Core 3.1 This chapter takes a short tour through the history of the .NET Framework before diving into what this version brings to the table. The chapter wraps up with a look at utilities and tools you will want to have before proceeding with exploring the details in the chapters that follow. We will cover a broad range of topics, including cross-platform usage of .NET, different methods for creating the visual layer, backend components such as identity and data access, as well as cloud technologies.
We will cover the following topics in this chapter:
  • Explaining ASP.NET Core
  • Refreshing your C# knowledge
  • Learning what's new with .NET 5 and C# 9
  • Understanding websites and web servers
  • Exploring Visual Studio Code
  • Leveraging Windows Terminal

Technical requirements

This chapter includes short code snippets to demonstrate the concepts that are explained. The following software is required:
  • Visual Studio 2019: Visual Studio can be downloaded from https://visualstudio.microsoft.com/vs/community/. The Community edition is free and will work for the purposes of this book.
  • Visual Studio Code: Visual Studio Code can be downloaded from https://code.visualstudio.com/Download.
  • .NET Core 5: The .NET Core framework can be downloaded from https://dotnet.microsoft.com/download/dotnet/5.0.
Make sure you download the SDK, and not just the runtime. You can verify the installation by opening Command Prompt and running the dotnet --info cmd as shown:
Figure 1.1 – Verifying the installation of .NET
Figure 1.1 – Verifying the installation of .NET
Please visit the following link to check the CiA videos: https://bit.ly/3qDiqYY
Check out the source code for this chapter at https://github.com/PacktPublishing/ASP.NET-Core-5-for-Beginners/tree/master/Chapter%2001/Chapter_01_HelloWeb.

Explaining ASP.NET Core

The first version of .NET was released in 2002, so it doesn't sound impressive that we're getting at version 5 since it's been 18 years. However, it is slightly more complicated than that, both with the numbering system and due to various sidetracks. A complete history could possibly be a book on its own, but to understand where we are now, we will take you on a short walk down memory lane.
When .NET came on the scene, there were a couple of options available to you for choosing a programming language depending on your scenario. Visual Basic was popular for introductory type programming since it was, as the name implies, visually oriented and easy to get started with. However, VB wasn't great for writing complex applications at scale with high performance. Windows itself was mostly written in C and C++ and was the preferred route for professional-grade software. While these languages were (and still are) highly capable, they were notorious for allowing the programmer to shoot themselves in the foot due to things such as making the coder responsible for memory management and other low-level operations that were hard to debug and troubleshoot.
In parallel with the language implementations offered directly from Microsoft, Sun Microsystems released Java as a solution to these challenges. Instead of producing native code, the tooling produced managed code that abstracted memory management and made things easier. The syntax of the language was in the C++ style, so transitioning from C++ was easy for developers looking to make the switch to Java. It was also a stated goal that the code written should be portable to multiple platforms. This was enabled by a Java Virtual Machine (JVM), which was installed to execute on a given system.

Managed versus unmanaged code

Programming languages have evolved over the years. Where the first computers were programmed by physically turning switches and levers, you can now write instructions where even non-programmers are able to figure out what some of the commands mean.
One often refers to the relative closeness to the computer's native language (zeros and ones) by referring a language as low-level (close) or high-level (abstract). At the lowest level, you have languages like assembler language, which theoretically have the least overhead (provided you can find highly talented programmers), but in addition to being complex, an assembler language is not portable across different CPU architectures. C# leans more towards the other end of the spectrum, with more natural language and many of the "hard things" are hidden from the programmer. And there are also languages that are even more high-level, such as Scratch (a block-based language), targeted at kids wanting to get into programming. (There is no formal definition of low versus high.)
One of the mechanisms C# uses to achieve this is by having an intermediate layer (for .NET this is the Common Language Runtime) that translates your code in real time to the underlying machine code understood by your computer. This means that the programmer does not need to handle allocating and releasing memory, does not interfere with other program's processes, and so on, and generally does a lot of the grunt work. To cater to the developers and enable them to create applications with a minimal re-learning experience, .NET was in demand for these platforms, but .NET was not built to run without the desktop components available.
The concept is not new to or unique for C#, and it is also the concept used in Java. Originally, it was conceived back in the IBM mainframe era. On personal computers, it was initially challenging since managed code will always have an overhead due to the translation that occurs, and on resource-constrained computers (when .NET 1.0 was released), it can run slow. Newer computers handle this much more efficiently, and .NET has been optimized over the years, so for most applications, it is not much of an issue any longer if the code is managed or not.

Introducing the .NET platform

Microsoft took inspiration from Java, as well as their learnings from the ecosystem they provided, and came up with .NET. The structure of the platform is displayed in Figure 1.2.
.NET was also based on managed code and required a Common Language Runtime (CLR) to be installed to execute. The C# language was released in the same time frame, but .NET also supported Visual Basic and J#, highlighting that it was a more generic framework. Other programming languages that required extra software to be installed for running applications h...

Indice dei contenuti