Web Applications with ASP.NET Core Architecture and Patterns guidance (Updated for .NET Core 2.0)

Earlier this year, we published this eBook/Guide and sample application offering guidance for Architecting Modern Web Applications with ASP.NET Core and Microsoft Azure. We have recently published updates to the eBook (2nd edition) and sample application to bring them in line with the latest releases of ASP.NET Core 2.0 and Entity Framework Core 2.0.

What’s new

The eBook/Guide has been updated to ASP.NET Core 2.0, .NET Standard Library 2.0 and Entity Framework 2.0 and .NET Core 2.0 in general, while referencing to the new code implemented in the updated sample app for ASP.NET Core 2, as well. The sample application (eShopOnWeb) has been expanded to support additional functionality over what existed in the initial version. Specifically, in addition to allowing users to manage a shopping cart, log in, and check out, users can now view past orders. Orders also include shipping address data, which is implemented as a value object pattern using the new owned entities in EF Core 2.0. All of the projects have been updated to the ASP.NET 2.0, netstandard 2.0, and EF Core 2.0, as appropriate. Also, the identity management system has been updated to use the latest ASP.NET Identity 2.0 version, which includes built-in support for Two Factor Authentication (2FA) using an Authenticator app. In addition, the sample now makes use of the Specification pattern to improve the design of its data access and better follow separation of concerns. These additional application features were added to help make the sample more “real world” in nature, providing more opportunities to demonstrate new features and techniques available in ASP.NET Core. Finally, one of the new features added in ASP.NET Core 2.0 is Razor Pages, and so the eBook and the sample application have been updated to demonstrate side-by-side in separate web projects both a Razor Pages implementation and a Controllers-and-Views implementation of the same business application.

Details on updates targeting .NET Core 2.0

Summary

The previous blog post focused on Microservices architecture. However, even when microservices are great for certain scenarios explained in that previous blog post, for most of the medium-size application scenarios, you still will want to create regular web applications, also named “monolithic applications” because of their deployment style. Microservices shouldn’t be the new “silver bullet” to be used for everything but just for certain cases. Therefore, in many cases, you still will want to create regular/monolithic web applications but using modern approaches and modern technologies.

Introducing the ‘Architecting Modern Web Applications with ASP.NET Core and Microsoft Azure’ Guide/eBook

Building web applications with ASP.NET Core, hosted in Microsoft Azure, offers numerous competitive advantages over traditional alternatives.

ASP.NET Core is optimized for modern web application development practices and cloud hosting scenarios.

In this guide, you will learn how to architect your ASP.NET Core applications to best take advantage of these capabilities.

eBook author: Steve Smith

.NET Core and ASP.NET Core offer multiple advantages over traditional .NET development. You should use .NET Core for your server applications if some or all of the following are important to your application’s success:

Traditional .NET applications can and do support some of these requirements, but ASP.NET Core and .NET Core have been optimized to offer improved support for the above scenarios.

More and more organizations are choosing to host their web applications in the cloud using services like Microsoft Azure. You should consider hosting your application in the cloud if the following are important to your application or organization:

Who should use this guide

We wrote this guide for developers and solution architects who are new to ASP.NET Core while looking to learn and adopt a specific web application architecture applying proven patterns and best practices. You will also find this guide useful if you are a technical decision maker, such as an architect, who wants an architecture and technology overview before you decide on what approach to select for new and modern web applications.

Related sample ASP.NET Core web application: eShopOnWeb

The eShopOnWeb application (still in BETA state) is a sample reference web app based on ASP.NET Core. This application is open source and available at the eShopOnWeb GitHub repo.

The following diagram shows a high-level overview of the internal architecture of the sample ASP.NET Core web application:

The fact that a web application can have a monolithic deployment doesn’t mean that its internal design is also monolithic or “spaghetti code”.

Applications that follow the Dependency Inversion Principle as well as Domain-Driven Design (DDD) principles tend to arrive at a similar architecture. This architecture has gone by many names over the years. One of the first names was Hexagonal Architecture, followed by Ports-and-Adapters. More recently, it’s been cited as the Onion Architecture or Clean Architecture. It is this last name, Clean Architecture, that is used as the basis for describing the architecture in this eBook.

Clean architecture puts the business logic and application model at the center of the application.

Instead of having business logic depend on data access or other infrastructure concerns, this dependency is inverted: infrastructure and implementation details depend on the Application Core.

Here’s another view of an ASP.NET Core monolithic web application using multiple components related.

Visit the .NET Application Architecture Center and grab it all!

Remember that this ‘Web Applications with ASP.NET Core Architecture and Patterns guidance’ explained at this blog post is part of a broader .NET Architecture guidance which covers additional subjects and you can check out at the .NET Application Architecture Center page where you can download the multiple eBooks/Guides and visit the reference applications from there, and of course, feel free to provide feedback by dropping a note below or on the feedback form at the architecture page.

image

Happy coding from the .NET team!