.NET

Updated: 29 January 2023

.NET is an open source developer platform (i.e. the Languages & Libraries) for building different types of apps. The supported languages are C#, Visual Basic and F#.

Target platforms are:

  • .NET Core which runs on Windows, Linux and macOS.
  • .NET Framework for websites, services and apps on Windows only.
  • Xamarin / Mono, a .NET for mobile e.g. iOS devices, Apple Watch/TV Android.

https://docs.microsoft.com/dotnet
https://aka.ms/dotnethelloworld

 

The Host

A container which offers built-in services:

  • Dependency injection – a technique for achieving Inversion of Control between classes and their dependencies.
  • Configuration
  • Logging
  • Options pattern
  • Host Services

.NET 6 offers Generic DefaultHost which can be configured for the application use cases.

Hosted Service

A service which performs work in the background. Any reference type object which implements IHostedService is a background / hosted / worker service.

DI Service Container

Class dependencies can be registered in a service container.

.NET provides a built-in service container, IServiceProvider. Services are typically registered at the app’s start-up and appended to an IServiceCollection. Once all services are added BuildServiceProvider is used to create the service container.

Dependency Injection injects the service into the constructor of the class where it’s needed. The framework takes on the responsibility of creating an instance of the dependency and disposing of it when it’s no longer needed.

Leave a comment