.Net is an excellent framework for businesses as it provides simple solutions for a wide variety of applications, from web development and AI to desktop apps and cloud infrastructure. The fact that this environment is designed and supported by Microsoft makes it reliable and provides a whole series of facilities, saving developers a lot of time.
Besides, since Microsoft made .Net open-source in 2014 to encourage cross-platform development and enrich its ecosystem, a lot of useful .NET libraries were added to those provided by the company.
Reviewing 8 of the top libraries of the .Net environment.
1) Logging Frameworks: Nlog or Serilog
There are 3 preponderant logging frameworks for .Net, and all of them are free and work great: Serilog, Nlog, and log4net. As log4net was broadly inspired by log4j, Nlog was the first option to be designed especially for .Net, and overcomes the first one for obvious reasons.
In comparison, both Serilog and Nlog are good options.
Nlog
Nlog was launched in 2006, and it’s the first option that wasn’t just a migration from Java. It summed cleaner APIs and several .Net-specific features. As a result, it has an easy configuration.
Serilog
This library’s first innovation, when it came out in 2013 was bringing structured logging support, which wasn’t yet available for Nlog at the time. Nlog also supports it now besides text, but its recent addition understandably has performance consequences. Serilog is also the easiest one to set up.
2) Object-object mapping solution: Automapper
In C#, copying the data from one object to another requires creating and populating the first object manually. This is obviously tedious but more important it generates timeliness problems if we’re working on real-time projects with interaction between UI and service layers.
An easy solution for this is found in Automapper, which transforms an input object of one type into an output object of another type to map the properties of two different objects.
3) Validation rules builder: FluentValidation
Data Validation is a key aspect of any application. FluentValidation takes the place of the existing validation attributes (Data Annotations). It really improves the process of creating validations, giving you complete control. It keeps the validation rules and/or logic separate from the Model/DTO classes.
4) Open API documentation with Swagger
Swagger is a set of tools for documenting Web APIs that are based on the OpenAPI Specification (OAS). It allows both computers and humans to understand the capabilities of a REST API without direct access to the source code.
Swagger documents the method information we created in our project automatically. Application developers who want to use our API with each request and response information can view this method information.
Swagger is made up of two parts.
- The Swagger Specification is the first and most important of these. Here is a swagger.json file that Swagger generates automatically. With each API update, this file is updated and contains information about our API methods.
- The second component is known as Swagger UI. We can get visual information about the API methods here. The methods’ work, the answers they provide, and the parameter information they receive can all be viewed.
5) Nodatime: Advanced date/time library
For some time, there have been time zone issues both for Java and C#, generating several seemingly silly bugs.
In the case of .Net, this was solved by Nodatime. This library is an alternative date and time API for .Net. It helps you to think about your data more clearly, and express operations on that data more precisely.
6) Create schemas for APIs with GraphQL
GraphQL is designed to make APIs fast, flexible, and developer-friendly. It’s basically a query language for your API as well as a server-side runtime for query execution based on a type system you define for your data. GraphQL is not dependent on any specific database or storage engine, but rather on your existing code and data.
A GraphQL service is created by first defining types and fields on those types, followed by functions for each field on each type.
7) Open source message broker: RabbitMQ
Message brokers are applications that enable other apps to send and receive messages asynchronously. As a result, we can create highly scalable, decoupled applications that do not rely on synchronous actions to communicate, such as HTTP. Any binary encoded data can be used as a message to be sent from one application to another.
RabbitMQ is a lightweight messaging protocol that is simple to deploy both on-premises and in the cloud. It supports a variety of messaging protocols. To meet high-scale, high-availability requirements, RabbitMQ can be deployed in distributed and federated configurations.
8) Generate and read CSV files with CSV Helper
If you need to read and write CSV files quickly, easily, and in a flexible manner, you can use CSV Helper, a.NET open-source library with many features. The library is built on.NET Standard 2.0, allowing it to run in almost any environment.
Ready to leverage .Net?
This development environment provides amazing opportunities for creating all kinds of apps. Are you ready to make the most of it?
Contact us in case of needing help developing .Net solutions. Our talents are ready to join your team and take your business to the next level!