Thursday, January 31, 2019

Introduction to ASP.NET Core

What is ASP.NET Core?

  • ASP.NET Core is a free and open-source web framework, developed by Microsoft and the community 
  • ASP.NET Core is a cross-platform, high performance, open-source framework for building modern, cloud-based, interconnected applications
  • ASP.NET Core is redesign of ASP.NET 4.x
  • It is a modular framework that runs on both the full .NET Framework, on Windows, and the cross-platform .NET Core

ASP.NET Core provides the following benefits:

  • A unified programming model for building web UI and web APIs
    • Both the MVC Controller class and ASP.NET Web API class inherit from the same “Controller” base class and returns IActionResult
  • Cross Platform 
    • Ability to develop and run on Windows, macOS, and Linux
    • Ability to host on IIS, Nginx, Apache, Docker, or self-host in your own process.
  • Built-in dependency injection
  • Architected for testability
  • Open-source and community-focused
  • A lightweight, high-performance, and modular HTTP request pipeline.

Choosing between .NET Core and .NET Framework

  • There are two supported implementations for building server-side applications with .NET
    • .NET Framework
    • .NET Core
  • Both share many of the same components and you can share the code across the two

Choose .NET Core When:

Cross-platform needs
  • If your application (web/service) needs to run on multiple platforms (Windows, Linux, and macOS), use .NET Core
Microservices architecture
  • A microservices architecture allows a mix of technologies across a service boundary
  • For example, you can mix microservices or services developed with .NET Framework, Java, Ruby, or other technologies
Many infrastructure platform like Azure Service Fabric - designed for large and complex microservice systems, Azure App Service - good choice for stateless microservices. 
  • Microservices based on Docker fit any kind of microservices approach, and all these platform supports .NET Core
Containers
  • Containers are commonly used in conjunction with a microservices architecture
  • When creating and deploying a container, the size of its image is much smaller with .NET Core than with .NET Framework
  • Because it's cross-platform, you can deploy server apps to Linux Docker containers, for example
  • Docker containers can be hosted in your own Linux or Windows infrastructure, or in a cloud service such as Azure Container Service. which can manage, orchestrate, and scale container-based applications in the cloud
A need for high-performance and scalable systems
  • When your system needs the best possible performance and scalability, use .NET Core
  • Performance and scalability are especially relevant for microservices architectures, where hundreds of microservices may be running.
A need for side by side of .NET versions per application level
  • To install applications with dependencies on different versions of .NET,  .NET Core is recommended. 
  • .NET Core offers side-by-side installation of different versions of the .NET Core runtime on the same machine. 
Choose .NET Framework When:

.NET Core offers significant benefits, however the .NET Framework continues to be the natural choice for many existing scenarios as the .NET Framework isn't replaced by .NET Core for all server applications

Current .NET Framework applications
  • In most cases, we don’t need to migrate our existing applications to .NET Core
  • Instead, a recommended approach is to use .NET Core when existing application need to be extend (e.g writing a new web service)
A need to use third-party .NET libraries or NuGet packages not available for .NET Core
  • Only in cases where the libraries or NuGet packages use technologies that aren't available in .NET Standard/.NET Core, you need to use the .NET Framework.
A need to use .NET technologies not available for .NET Core

Need to use a platform that doesn’t support .NET Core
  • Some Microsoft or third-party platforms don’t support .NET Core. 
  • For example, some Azure services such as Service Fabric Stateful Reliable Services and Service Fabric Reliable Actors require .NET Framework. 
Some .NET Framework technologies aren't available in .NET Core as of release ASP.NET Core 2.2 version
  • ASP.NET Web Forms applications
  • ASP.NET Web Pages applications
  • WCF services implementation
  • Workflow-related services
  • Language support

Different modules need to know along side of ASP.NET Core

  • Entity Framework (EF) Core
  • Identity Core
  • MVC Core
  • Razor Core







1 comment: