Important Libraries in .NET Core

Net Core is a free open-source platform that was developed by Microsoft. .NET core is a cross platform that supports almost every operating system like macOS, Windows and Linux.

.NET Core is a great platform embedded with a lot of characteristics that help them build cloud-based applications, device applications. Apart from that, Asp.Net Core is also known for Security as it supports the Global Exception Handling feature, which helps in eliminating uncertain errors. All these characteristics make it an efficient platform for web development.

Advantage and disadvantage of .NET core

Advantages:

  • .NET core is an open source, faster framework.
  • It reduces coding time.
  • ASP.NET Core is multiplatform support, that means you can develop on OS X, Linux and Windows and you can deploy it to OS X, Linux, FreeBSD or Windows servers.

Disadvantages:

  • You cannot use Xamarin with .NET Core at this point.
  • In case we already create a project in .NET framework then no need to migrate the existing project to .NET Core.
  • WPF and Window Forms support is still being added to .NET Core

Most important C# .NET Core Libraries:

  • Swashbuckle
  • Polly
  • AutoMapper
  • SaasKit
  • Diagnostics. HealthChecks
  • MailKit
  • CacheManager
  • Dapper
  • Swashbuckle

Swashbuckle is a library that is use to generate beautiful API documentation. Swashbuckle is also known as Swagger.  This library allows you to describe all the structure of your APIs so that machines can read API Logic easily. Swashbuckle is an open source project for generating Swagger documents for Web APIs that are provided by ASP.NET Core.

You can add the Swashbuckle NuGet package and Install-Package Swashbuckle.AspNetCore

  • Polly

Polly is an ASP.NET library and when you define Polly library exception-handling policy, the policy internally catches matched exceptions and handle them as the policy, defines: orchestrate a retry; update circuit-breaker statistics;

Polly is a .NET core resilience and transient – fault – handling library that allows developers to express policies such as Retry and Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner etc.

you can Add the Polly NuGet package Microsoft.Extensions.Http.Polly

  •  Automapper 

AutoMapper is a popular object-to-object mapper library that is used to map the properties of two different objects. That really reduces developer work and to help us to avoid unwanted code when mapping values.  That is a simple library built to solve a code related complex error – getting rid of code that mapped one object to another object.

AutoMapper libraries helps you to copy data from one type of object to another different type of object. It is just like an object-object mapper.

you can add automapper NuGet package using this command install-Package AutoMapper

  •  SaasKit

This library is use to build multitenant applications which is quite difficult. SaaSkit library concept adds middleware using the OWIN interface. SaasKit is a developer’s toolkit for building SaaS (Software as service).

you can install Automapper NuGet package using this command

Install-Package SaasKit. Multitenancy. Mvc

You can use SaasKit to simplify our tenant handling. SaaSkit can be added into our project.json which may look alike the below syntax.

{

“dependencies”: {

“SaasKit.Multitenancy”: “1.1.2”,

},

}

SaaSkit library will be used to identify the associated tenant for a given request. If a tenant is found that returns a TenantContext<AppTenant>, if no tenant can be resolved and that returns a null.

  •  Diagnostics. HealthChecks

Diagnostics. Health library is helpful in checking and specifying a database query to run as a Boolean test to indicate if the database is responding normally or not.

This library offers a middleware for returning the results of Health Checks in over project. This Library also reports the information and handle exceptions with errors in ASP.NET Core. It diagnoses Entity Framework Core migrations related errors.

You can add package like that

Install-Package Microsoft.AspNetCore.Diagnostics.HealthChecks -Version 2.2.0

  1. MailKit

ASP.NET core MailKit’s library is a personal open source project that you have to put for thousands of hours into perfecting with the goal of making it the very best email framework for .NET core.  This is used to send mail in ASP.NET core. MailKit works on multiple platform like Windows, MAC, Linux and Mobile etc.

You can add a reference to MailKit NuGet package to project. If project have already reference of the MailKit then try running dot net and restore to get and update the reference locally.

You can add package like that Install-Package MailKit.

  •  CacheManager

ASP.NET have lots of library, CacheManager is an open source caching framework for .NET core in C# backend and is available via NuGet and console command. It supports various cache providers and implements many advanced features of cache memory. Caching is a one type of technique to storing data/information frequently in memory.

CacheManager is not just an interface to programming model for different cache providers, and that will make it easy to change the caching strategy on over project. it’s also offers additional features that is cache synchronization, concurrent updates, serialization, events, performance etc. The developer can opt – in to which one features only if needed.

  •  Dapper

ASP.NET core provides dapper library. Dapper is class and a micro ORM Dapper which provides minimal overhead and really helps you out only with some core basics. Dapper means to be trim in dress and appearance.

Dapper is a one of the NuGet library that can be added to any project. It extends the IDbConnection interface. The IDbConnection interface display is an open connection to data source added by the .NET framework.

You can install package using this command like Install-Package dapper.

Conclusion 

In this blog, we have portrayed how to use mostly all ASP.NET Libraries in your own development work today. This blog is used for understanding the concept of .NET Core Library. We hope you liked this article on ASP.NET Core Library.  This blog is helpful to you as we have also discussed about all factors of Core Library in this blog. The main purpose of Libraries is to provide the various types of functionality in .NET core. You can add library using two different ways first one is using NuGet package and another is through console command.

courtesy: icoginix.com

Leave a Reply

Your email address will not be published. Required fields are marked *