What is .NET Core: A Quick Overview

What is .NET Core?

.NET Core is an open-source, cross-platform general-purpose development platform designed to be lightweight, modular, and versatile. (GitHub)

.NET Core was first announced by Microsoft in 2014 as a redesigned, open-source, and cross-platform successor to .NET Framework. The first version, .NET Core 1.0, was released in 2016. Major versions since then include .NET Core 2.0 in 2017, .NET Core 3.0 in 2019, and in 2020 it was released as .NET (omitted the word “Core”) with version .NET 5. Current version is .NET 7 and the upcoming .NET 8 is scheduled to be released in November 2023.

The goal of .NET Core was to create a .NET platform optimized for modern cloud workloads. By re-implementing .NET Runtime and Framework as open source, Microsoft aimed to make .NET cross-platform and open for contribution from the developer community.

The .NET Foundation, established by Microsoft on March 31, 2014, aims to enhance open-source development and foster collaboration within the .NET ecosystem.

What is .NET Core used for:

  • Web apps: .NET Core is a great choice for building web applications, using ASP.NET Core.
  • Web APIs: For building RESTful services.
  • Microservices: .NET Core is a great choice for building microservices, which are small, independent services that can be used to create larger distributed systems.
  • Console apps: Utility apps and command-line tools. .NET Core can be used to build console applications, which are command-line applications that can be run from the command prompt.
  • Desktop apps: Using WinUI (for Windows only) and .NET MAUI (cross-platform) we can build stunning desktop applications.
  • Mobile apps: .NET Core can be used to build mobile applications using Xamarin and MAUI, which allows developers to share code with iOS, Android, and Windows platforms.
  • Machine learning: Using the ML.NET framework, we can build and train custom machine learning models.
  • Cloud-native apps: Taking advantage of containers and orchestrators like Kubernetes.
  • IoT apps: Running on small-footprint devices like Raspberry Pi. .NET Core can be used to build IoT applications, including applications that run on embedded devices and sensors.
  • Games: We can also use .NET Core to build games using the Unity game engine.

What is .NET Core vs .NET Framework?

.NET Core and .NET Framework are both development platforms from Microsoft, but they differ in several key aspects. While .NET Core is cross-platform and runs on Windows, Linux, and macOS, .NET Framework is limited to Windows. In terms of accessibility, .NET Core is open source, allowing developers to contribute and inspect its codebase, but the .NET Framework remains proprietary.

.NET Core boasts enhanced startup times and optimized resource utilization, particularly suited for cloud-based applications. Additionally, not all APIs from the .NET Framework are available in .NET Core, though Microsoft is progressively porting them over.

.NET Core apps benefit from a modular approach using NuGet packages, often resulting in smaller application footprints, while .NET Framework applications depend on a system-wide installer (can also use NuGet for additional features). In essence, .NET Core represents a forward-thinking evolution from .NET Framework, crafted with modern application architectures in mind, such as cloud computing and microservices, whereas .NET Framework remains vital for legacy Windows-only applications.

What is Dapper in .NET Core?

Dapper (a micro ORM) is a popular open-source library for .NET that simplifies the process of working with databases. It was created by Sam Saffron (a senior software engineer at Stack Overflow) in 2011.

Dapper allows developers to write database queries using a simple, SQL-like syntax, and it provides a way to execute those queries against various databases, including SQL Server, MySQL, PostgreSQL, and Oracle.

It is available as a NuGet package. Dapper is often used in .NET Core applications to simplify data access and reduce the amount of code required to interact with databases.

What is Dependency Injection in .NET Core?

Dependency injection is a technique that allows components to be loosely coupled, making it easier to test, maintain, and extend the system. Instead of having classes create their own dependencies or directly reference them, the dependencies are "injected" into the classes that require them.

In .NET Core, dependency injection is built into the framework, making it easy to use and integrate into applications.

What is IoC container in .NET Core?

An IoC (Inversion of Control) Container in .NET Core is a component used for dependency injection. It manages object creation and resolves dependencies automatically. When an application is started, dependencies are registered with the container. During runtime, the container provides instances of these dependencies when requested. This promotes loose coupling, making code more modular and testable. .NET Core includes a built-in IOC container but can also integrate with third-party containers.

In .NET Core, Microsoft's default IoC container is available through the IServiceProvider interface. It is lightweight, fast, and supports common scenarios.

For more complex scenarios, third-party containers like Autofac can be used by implementing the same interface.

What is Kestrel in .NET Core?

Kestrel is a web server for .NET Core, designed to be fast, efficient, and secure. It is a drop-in replacement for the traditional IIS web server and can be used to host web applications, APIs, and microservices. It is optimized for high performance and is Cross-platform, open-source available on GitHub.

Kestrel supports all the latest web features like WebSocket support which can be used to build real-time web apps with ASP.NET Core and .NET Core.

Summary

.NET Core is a versatile framework that we can use to build wide range of applications. It provides a number of benefits over the traditional .NET Framework, including better performance, cross-platform compatibility, and a more modular design.

Developers can use Dapper to simplify data access, dependency injection to loosely couple components, and the built-in IoC container to manage dependencies. Kestrel is a fast and efficient web server that is used to host web applications and APIs.

.NET Core is a popular choice for building modern web applications and microservices and is well-suited for building scalable, high-performance applications that can run on a variety of platforms.

Frequently Asked Questions about What is .NET Core

Run “dotnet --version” in the command line.

AutoMapper is a library to map objects from one type to another, simplifying object-to-object mapping.

ILogger is an interface for logging messages in .NET Core, offering a consistent way to log throughout your application.

.NET Core CLI is a set of tools for developing, building, and running .NET Core applications from the command line.

People also ask about What is .NET Core

.NET Core Runtime is the environment where .NET Core applications are executed. It includes just the resources needed to run existing apps.

.NET Core SDK (Software Development Kit) includes everything needed to develop .NET Core applications, including the runtime, libraries, and CLI tools.

Middleware in .NET Core are components that handle requests and responses, forming a pipeline between the server and application.

SignalR in .NET Core is a library that enables real-time web functionality, allowing server-side code to push content to clients instantly.

Home | About Us | Privacy | Terms of Use | Contact
© 2023 ASPNETCore.net