Exploring .NET Core with Microservices, ASP.NET Core, and Entity Framework Core
With chapters selected by Dustin Metzgar
  • October 2017
  • ISBN 9781617295089
  • 155 pages

Windows developers have always enjoyed the productivity boost you get with the .NET platform, tools like Entity Framework and ASP.NET, and the amazingly-powerful C# language. Now, .NET Core extends those same benefits to Linux-based systems, offering a true cross-platform solution for enterprise application development. The .NET Core tools, including Entity Framework Core and ASP.NET Core, are lightweight and modular, and they offer similar performance to native Linux and JVM-based frameworks without requiring you to learn a new toolset or rebuild your applications. In a world where platform lock-in is an unpardonable sin, .NET Core offers a perfect pathway to the cloud-based, distributed environments that rule the day.

Exploring .NET Core with Microservices, ASP.NET Core, and Entity Framework Core is a collection of five hand-picked chapters introducing you to the art of applying modern development practices and patterns to your .NET Core projects. In it, you'll get a quick overview of what ASP.NET Core and Entity Framework Core offer, along with an introduction to microservices and web applications using .NET Core tooling. You'll also get some tips on working with legacy code in this new environment. In short, this free eBook will get your feet wet and show you real-world examples that illustrate what's possible.

Table of Contents detailed table of contents

Introduction

Refactoring

4 Refactoring

4.1 Disciplined refactoring

4.1.1 Avoiding the Macbeth Syndrome

4.1.2 Separate refactoring from other work

4.1.3 Lean on the IDE

4.1.4 Lean on the VCS

4.1.5 The Mikado Method

4.2 Common legacy code traits and refactorings

4.2.1 Stale code

4.2.2 Toxic tests

4.2.3 A glut of nulls

4.2.4 Needlessly mutable state

4.2.5 Byzantine business logic

4.2.6 Complexity in the view layer

4.3 Testing legacy code

4.3.1 Testing untestable code

4.3.2 Regression testing without unit tests

4.3.3 Make the users work for you

4.4 Summary

What’s inside

Identifying and Scoping Microservices

3 Identifying and Scoping Microservices

3.1 The primary driver for scoping microservices: business capabilities

3.1.1 What is a business capability?

3.1.2 Identifying business capabilities

3.1.3 Example: point-of-sale system

3.2 The secondary driver for scoping microservices: supporting technical capabilities

3.2.1 What is a technical capability?

3.2.2 Examples of supporting technical capabilities

3.2.3 Identifying technical capabilities

3.3 What to do when the correct scope isn’t clear

3.3.1 Starting a bit bigger

3.3.2 Carving out new microservices from existing microservices

3.3.3 Planning to carve out new microservices later

3.4 Well-scoped microservices adhere to the microservice characteristics

3.4.1 Primarily scoping to business capabilities leads to good microservices

3.4.2 Secondarily scoping to supporting technical capabilities leads to good microservices

3.5 Summary

What’s inside

Creating and Communicating with Web Services

7 Creating a Microservice

7.1 Writing an ASP.NET web service

7.1.1 Converting Markdown to HTML

7.1.2 Creating an ASP.NET web service

7.1.3 Testing the web service with Curl

7.2 Making HTTP calls

7.3 Making the service asynchronous

7.4 Getting data from Azure blob storage

7.4.1 Getting values from configuration

7.4.2 Creating the GetBlob method

7.4.3 Testing the new Azure storage operation

7.5 Uploading and receiving uploaded data

7.6 Listing containers and blobs

7.7 Deleting a blob

7.8 Summary

What’s inside:

Creating Web Pages with MVC Controllers

4 Creating web pages with MVC Controllers

4.1 An introduction to MVC

4.1.1 The MVC design pattern

4.1.2 MVC in ASP.NET Core

4.1.3 Adding the MvcMiddleware to your application

4.1.4 What makes a controller a controller?

4.2 MVC Controllers and action methods

4.2.1 Accepting parameters to action methods

4.2.2 Using ActionResults

4.3 Summary

What’s inside

Querying the Database

2 Querying the Database

2.1 Setting the scene—​my book-selling site example

2.1.1 Our book-selling site relational database

2.1.2 Other relationship types not covered in this chapter

2.1.3 The final database showing all the tables

2.1.4 The classes that EF Core maps to the database

2.2 Creating the application’s DbContext

2.2.1 Defining my application’s DbContext: EfCoreContext

2.2.2 Creating an instance of my application’s DbContext

2.2.3 Creating a database for your own application

2.3 Anatomy of a database query

2.3.1 Application’s DbContext Property access

2.3.2 A series of LINQ/EF Core command

2.3.3 The execute command

2.4.1 Eager loading: loading relationships with the primary entity class

2.4.2 Explicit loading: loading relationships after the primary entity class

2.4.3 Select loading: loading the specific parts of primary entity class and any relationships

2.5 Client vs. Server evaluation: moving part of your query into software

2.5.1 An example of using Client vs. Server evaluation to create the display string of s book’s authors

2.5.2 Understanding the limitations of Client vs. Server evaluation

2.6 Building complex queries—​the book-selling site

2.6.1 Building the book list query using select loading

2.6.2 Introducing the architecture of the book-selling site application

2.7 Adding Sorting, Filtering, and Paging to the book-selling site

2.7.1 The sorting of books by price, publication date and customer ratings

2.7.2 The filtering of books by publication year and customer ratings

2.7.3 The paging of the books in the list

2.8 Putting it all together: how to combine query objects

2.9 Summary

What’s inside:

About the author

Dustin Metzgar has developed software professionally for 13 years. He has worked for many companies from startups to large enterprises before joining Microsoft. He specializes in performance in both .NET and Azure services and participated in a number of .NET Core projects. Dustin owns several products, including the Windows Workflow Foundation.

Buy
eBook $0.00 PDF only

FREE domestic shipping on three or more pBooks