0%

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.

Table of Contents

  1. Adopting .NET 5
  2. Why subscribe?
  3. Contributors
  4. About the authors
  5. About the reviewers
  6. Packt is searching for authors like you
  7. Preface
    1. Who this book is for
    2. To get the most out of this book
    3. Download the example code files
    4. Download the color images
    5. Conventions used
    6. Get in touch
    7. Reviews
  8. Section 1: Features and Capabilities
  9. Chapter 1: Introducing .NET 5 Features and Capabilities
    1. Technical requirements
    2. Evolution of .NET
    3. Discovering the distinguishing factors in .NET versions
    4. Understanding the advantages of one over the other
    5. What is the outlook for jumping to .NET 5?
    6. Types of applications developed using .NET
    7. Web applications
    8. Mobile development
    9. Desktop applications
    10. Internet of Things
    11. Cloud-native development and microservices
    12. Machine learning
    13. Visual Studio solution templates for .NET
    14. What are the .NET 5 headliners?
    15. Discovering self-contained applications
    16. .NET 5 app trimming optimizations
    17. ReadyToRun
    18. Developing programs for .NET
    19. Performance improvements
    20. Why performance is so important?
    21. Performance improvements in .NET versions
    22. Let's do some benchmarking
    23. .NET release schedule
    24. .NET support life cycle
    25. .NET Framework support
    26. .NET Core support
    27. Summary
  10. Chapter 2: What's New in C# 9?
    1. Technical requirements
    2. Having prior knowledge of C#
    3. The .NET Framework requirements to use C# 9
    4. Configuring LINQPad 6 for .NET 5 and C# 9
    5. Understanding what's new in C# 9
    6. Writing concise code with pattern matching
    7. Keeping track of changes – immutable records
    8. Letting the new keyword infer the type for us
    9. Embracing other productivity enhancements
    10. Leveraging performance improvements
    11. Introducing Span<T>
    12. Choosing the winner – Substring versus Slice showdown
    13. Utilizing .NET library performance improvements
    14. Summary
    15. Further reading
  11. Section 2: Design and Architecture
  12. Chapter 3: Design and Architectural Patterns
    1. Technical requirements
    2. Why should we follow design strategies?
    3. Application design patterns
    4. Refreshing the GoF design patterns
    5. Refresher of the SOLID design principles
    6. Dependency injection
    7. The Repository pattern
    8. Communication styles and protocols
    9. Synchronous and asynchronous communication
    10. Standard communication protocols
    11. Architectural patterns
    12. Monolith application architecture
    13. Microservices architecture
    14. Backend for Frontend (BFF)
    15. Serverless architecture
    16. Enterprise Service Bus (ESB)
    17. Distributed processing
    18. Summary
  13. Chapter 4: Containerized Microservices Architecture
    1. Technical requirements
    2. Why overview other topics and not just microservices?
    3. The gRPC communication protocol
    4. HTTP/2 and Protobuf
    5. gRPC versus REST APIs versus SOAP
    6. What's new with gRPC in .NET 5?
    7. Sample service proto file
    8. What is WSL?
    9. Installing WSL on your development machine
    10. Some useful VS Code-related extensions
    11. Things to check before you start debugging with WSL
    12. WSL as a Docker engine
    13. What is Tye?
    14. Introduction to containerization and container orchestration
    15. What are some modern container fundamentals?
    16. Kubernetes basics
    17. Let's build a demo microservices application
    18. What is the application?
    19. Architecture for the demo application
    20. Developing the microservices application
    21. Summary
    22. Further reading
  14. Section 3: Migration
  15. Chapter 5: Upgrading Existing .NET Apps to .NET 5
    1. Technical requirements
    2. Choosing the migration approach
    3. Factors influencing the migration approach
    4. Lift and shift versus architectural transformation
    5. Replacing third-party libraries with platform-provided features
    6. Points to ponder regarding an as-is upgrade
    7. Unsupported technologies
    8. Unsupported Windows OS-specific features
    9. Transforming application configuration
    10. Choosing the Entity Framework version
    11. Using .NET Framework compatibility
    12. Upgrading third-party NuGet packages
    13. Upgrading a .NET Framework example app
    14. Introducing BookApp
    15. Preparing for migration
    16. Migrating BookApp.Models
    17. Upgrading the BookApp.DAL project
    18. Migrating the admin desktop app
    19. Migrating BookApp.Web
    20. Summary
    21. Further reading
  16. Chapter 6: Upgrading On-Premises Applications to the Cloud with .NET 5
    1. Technical requirements
    2. Using the source code provided for this chapter
    3. Planning for cloud-optimized application transformation
    4. Infrastructure as a Service (IaaS)
    5. Cloud-optimized applications
    6. Cloud-native applications
    7. Migrating SQL Server databases to the cloud
    8. Comparing Azure SQL options
    9. Migrating the BookApp database to Azure SQL Database
    10. Deploying .NET 5 applications on Azure App Service
    11. When should I use Azure App Service?
    12. Alternatives to Azure App Service
    13. Deploying BookApp.Web to Azure App Service
    14. Best practices for deploying applications to Azure App Service
    15. Serverless deployment – Azure Functions
    16. Benefits of using Azure Functions
    17. Developing a function app project
    18. Deploying the sentiment analysis function
    19. Integrating the Azure function with BookApp
    20. Deploying .NET 5 applications to containers
    21. Cleaning up resources
    22. Summary
  17. Section 4: Bonus
  18. Chapter 7: Integrating Machine Learning in .NET 5
    1. Technical requirements
    2. Machine learning explained for .NET developers
    3. Understanding the jargon
    4. Common types of ML problems
    5. ML workflow
    6. The importance of oil – I mean, data!
    7. Building an ML.NET-based service to predict the shopping score
    8. Introduction to ML.NET
    9. Obtaining the dataset
    10. Classifying the problem
    11. Enabling ML.NET Model Builder
    12. Creating the solution file
    13. Training the model
    14. Evaluating the prediction service
    15. Generating the code that will consume the model
    16. Exploring the auto-generated code
    17. Testing the application
    18. Building Azure Functions using ML.NET models
    19. Building the sentiment analysis service
    20. Consuming the model from an Azure function
    21. Summary
    22. Further reading
  19. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think
18.118.145.114