Adopting .NET 5
eBook - ePub

Adopting .NET 5

Understand modern architectures, migration best practices, and the new features in .NET 5

  1. 296 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Adopting .NET 5

Understand modern architectures, migration best practices, and the new features in .NET 5

About this book

A practical guide to building and upgrading new and legacy applications on cloud-native platforms using architectural best practices with.NET 5, C# 9, microservices, and ML.NET

Key Features

  • Get up to speed with.NET 5's new improvements and features
  • Discover how to improve existing code design and enhance software maintainability
  • Explore explanations and techniques for making programs easier to understand and change

Book Description

.NET 5 is the unification of all.NET technologies in a single framework that can run on all platforms and provide a consistent experience to developers, regardless of the device, operating system (OS), or cloud platform they choose.

By updating to.NET 5, you can build software that can quickly adapt to the rapidly changing demands of modern consumers and stay up to date on the latest technology trends in.NET.

This book provides a comprehensive overview of all the technologies that will form the future landscape of.NET using practical examples based on real-world scenarios, along with best practices to help you migrate from legacy platforms.

You'll start by learning about Microsoft's vision and rationale for the unification of the platforms. Then, you'll cover all the new language enhancements in C# 9. As you advance, you'll find out how you can align yourself with modern technology trends, focusing on everything from microservices to orchestrated containerized deployments. Finally, you'll learn how to effectively integrate machine learning in.NET code.

By the end of this.NET book, you'll have gained a thorough understanding of the.NET 5 platform, together with a readiness to adapt to future.NET release cycles, and you'll be able to make architectural decisions about porting legacy systems and code bases to a newer platform.

What you will learn

  • Explore the key performance improvement areas when migrating to modern architectures
  • Understand app design and development using.NET 5
  • Discover how to shift from legacy to modern application design using microservices and cloud-native architecture
  • Explore common migration pitfalls and make the right decisions in situations where multiple options are available
  • Understand the process of deploying.NET 5 code on serverless and containerized hosts, along with its benefits
  • Find out what ML.NET has to offer and build.NET apps that use machine learning services

Who this book is for

This book is for experienced developers as well as software architects who are looking to gain knowledge of the new features and capabilities of.NET 5, along with guidance on modern architectural patterns. If you're a developer who has previously worked on.NET, WPF, ASP.NET, Entity Framework, or other popular.NET libraries, this book will help you understand the migration process for their modern counterparts. Although experience with.NET Core is not required, working knowledge of the C# language and.NET framework is assumed.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Adopting .NET 5 by Hammad Arif,Habib Qureshi in PDF and/or ePUB format, as well as other popular books in Ciencia de la computación & Lenguajes de programación. We have over one million books available in our catalogue for you to explore.

Section 1: Features and Capabilities

The first section is about focusing on the grand picture. It introduces the .NET 5 technology and talks about its differentiating factors by comparing it with the previous .NET versions and technologies. It presents the .NET 5 feature set and examines its usability across different types of applications and platforms, such as web, desktop, mobile, cloud, and IoT.
It then highlights the performance improvements that have been one of the cornerstones of the new .NET platform. Finally, there is a chapter dedicated to C# developers, covering all the exciting language enhancements in C# 9 that help us write concise yet readable code.
This section comprises the following chapters:
  • Chapter 1, Introducing .NET 5 Features and Capabilities
  • Chapter 2, What's New in C# 9?

Chapter 1: Introducing .NET 5 Features and Capabilities

This book, as its title suggests, mainly features .NET 5 and all the related best practices that surround any major development processes for professional and enterprise applications. In this first chapter, I will summarize it for you to a great extent so that you get a top-level view at a glance.
We will take a look at how it all started with .NET historically, and through this, we will reflect on why .NET matters and what benefits we can obtain easily when choosing .NET as our primary development platform. Finally, we will see how long its technical support mechanism works for when we adopt .NET 5 as our main development platform.
While we will visit cloud-native apps topics later in this book in Chapter 4, Containerized Microservices Architecture, and Chapter 6, Upgrading On-Prem Applications to the Cloud with .NET 5, in this chapter, we will go deeper into .NET 5 features and the most useful performance improvements that we can leverage in all of our new applications and services. Since .NET 5 has been built on .NET 3.1, we will be revisiting some of the most significant capabilities offered from the previous version that are also still delivered perfectly and, in some cases, with enhanced performance by .NET 5.
In this chapter, we will be looking at the following major topics:
  • Evolution of .NET
  • Discovering the distinguishing factors in .NET versions
  • What is the outlook for jumping to .NET 5?
  • Types of applications developed using .NET
  • What are .NET 5 headliners?
  • Performance improvements
  • .NET release schedule
  • .NET support life cycle
By the end of this chapter, you will be able to see the history, the types of applications that are best built by .NET in certain environments for standalone as well as enterprise products. You will also be able to see and utilize the latest features of .NET and use the performance-oriented improvements directly in your new .NET 5-based applications and services.

Technical requirements

This chapter has two examples of code. In order to run them, the following are prerequisites:
  • .NET 5 SDK
  • .NET Framework 4.8
  • .NET Core 3.1
  • .NET 5
  • ab – Apache HTTP server benchmarking tool
More information on Apache Bench can be found here: http://httpd.apache.org/docs/current/programs/ab.html.
Online code for examples can be found at the following GitHub URL: https://github.com/PacktPublishing/Adopting-.NET-5--Architecture-Migration-Best-Practices-and-New-Features/tree/master/Chapter01

Evolution of .NET

Microsoft first started working on .NET at the turn of the century and released the first version of .NET around 18 years ago, in 2002. Then, it released its version 1.1 in 2003, version 2.0 in 2005, and so on. It is worth noting that there was no consistency in the release cycle.
Back then, it used to be known as Microsoft .NET Framework, but later, they commonly referred to it as .NET Framework. four years ago, in 2016, it emerged with a big shift vis-à-vis the open source world and with its primary focus on performance and backend applications, going by the name of .NET Core.
.NET Framework initially was a Windows-only platform and, not long after, there were non-Microsoft public domain ports to other Unix-based platforms with the name of Mono. Over time, Mono saw a lot of success with the general .NET Framework. In due course, we saw the emergence and popularity of Xamarin as a .NET-based platform for smartphone app development. Xamarin was based on Mono and was actually developed by the same engineers.
In 2016, Microsoft acquired Xamarin and, in the same year, it also introduced .NET Core as a free, open source, and managed framework for Windows, Linux, and macOS. It was a cross-platform and slim version of .NET Framework. With .NET Core, Microsoft's focus shifted toward open source technologies, embracing the advent of cloud-native development and container-based architecture in platforms other than just Windows. .NET Core 2.0 was released in August 2017, and .NET Core 3.0 in May 2019.
In 2020, Microsoft's vision is One.NET. What this means is that they want to avoid confusion and go fully open source with support for all platforms across all feature sets, in other words, merge .NET Framework and .NET Core. Hence, the next major release after .NET Core 3.1 will be .NET 5. From a developer's perspective, .NET is a cross-platform runtime with a huge class library that contains all the essential elements required to code web, desktop, or mobile applications; platform-specific as well as cloud-native across various tech verticals.
Programs in .NET can be developed with a variety of programming languages such as C++, Visual Basic, and Fortran (as F#), with C# being the most popular. C# is a feature-rich, object-oriented programming language initially based on the syntax of C/C++ and Java.
Any language used for programming in .NET meets a set of minimum requirements in terms of using the .NET class libraries. These requirements are called the Common Language Specification (CLS). They share a Common Type System (CTS), such as basic data types (integers and strings). CLS and CTS are also a part of the Common Language Infrastructure (CLI). CLI is an open specification that was actually developed by Microsoft and then standardized by ISO as well as ECMA.
.NET programs are compiled to a processor-independent intermediate language (IL). When .NET-based apps run on a particular platform, IL is compiled into a native code of the processor by a just-in-time (JIT) compiler. JIT compilation is implemented by the platform-specific Common Language Runtime (CLR). Code written in .NET is known as managed code since the actual machine language is translated by the CLR.
In every .NET program, CLR provides garbage collection services. It determines whether a memory block is no longer referenced by any variable in the application and will free up that fragment of memory as and when required.
.NET Core uses consistent and well-defined API models, written in what is called.NET Standard, which makes it portable and usable to many .NET applications. In this way, the same .NET library can be used in multiple platforms and in multiple languages. If you build the .NET Standard version as the target for the assembly of your .NET library instead of .NET Framework or .NET Core, then your library will be able to use both .NET Framework and .NET Core.
Now that we have covered a bit of the history regarding .NET Framework and .NET Core, let's look at the last big part of this chapter – learning about the distinguishing factors in .NET versions.

Discovering th...

Table of contents

  1. Adopting .NET 5
  2. Why subscribe?
  3. Preface
  4. Section 1: Features and Capabilities
  5. Chapter 1: Introducing .NET 5 Features and Capabilities
  6. Chapter 2: What's New in C# 9?
  7. Section 2: Design and Architecture
  8. Chapter 3: Design and Architectural Patterns
  9. Chapter 4: Containerized Microservices Architecture
  10. Section 3: Migration
  11. Chapter 5: Upgrading Existing .NET Apps to .NET 5
  12. Chapter 6: Upgrading On-Premises Applications to the Cloud with .NET 5
  13. Section 4: Bonus
  14. Chapter 7: Integrating Machine Learning in .NET 5
  15. Other Books You May Enjoy