DEV Community

Jéssica Nathany
Jéssica Nathany

Posted on • Edited on

Some useful Libraries for .NET projects

Alt Text

Introduction

I will share same libraries and packages to make your .NET project easier, and explain a little about their functionality.Note: You can copy copy the library links from github and paste them into your Notions.

NBuilder
Is a library that allows you to rapidly create test data, automatically. Some examples below.

NBuilder Github
Nuget: Install-Package NBuilder -Version 6.1.0

Alt Text

Alt Text

I wrote about this library in my last articleTools o improve your unit test with .NET. I have a Github repository about Unit Test and I used this library for test ([Unit Test]https://github.com/JessicaNathany/unit-test) the code ist portuguese but I will write in english.

Faker.NET

This library is a little diferent the NBuilder, because if you want something whic looks like actual names, address, email, thelephone numbers, etc you can use Faker.NET.

Faker.Net Github
Nuget: Install-Package Faker.Net -Version 1.5.148

Alt Text

Bogus

Bogus is a simple and sane fake data generator for .NET languages like C#, F# and VB.NET. Bogus is fundamentally a C# port of faker.js and inspired by FluentValidation's syntax sugar. Created by Brian Chavez.

Bogus Github
Nuget: Install-Package Bogus -Version 33.1.1

The example bellow is from repository Brian Chavez

Alt Text

Ocelot

Ocelot is a .NET API Gateway. This project is aimed at people using .NET running a micro services / service oriented architecture that need a unified point of entry into their system. However it will work with anything that speaks HTTP and run on any platform that ASP.NET Core supports.

Ocelot Github
Nuget: Install-Package Ocelot -Version 17.0.0

The example below is taken from the website Microsoft Documentation API Gateway with Ocelot.

Alt Text

Polly

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

Polly Github
Nuget: Install-Package Polly -Version 7.2.2

The example below is taken from repository Polly Github.

Alt Text

CacheManager

CacheManager is an open source caching abstraction layer for .NET written in C#. It supports various cache providers and implements many advanced features.

The main goal of the CacheManager package is to make developer's life easier to handle even very complex caching scenarios..

CacheManager Github
Nuget: Install-Package CacheManager.Core -Version 2.0.0-beta-1629

AutoMapper

AutoMapper is a simple little library built to solve a deceptively complex problem - getting rid of code that mapped one object to another.

Automapper Github
Nuget: Install-Package AutoMapper -Version 10.1.1

The example below is taken from repository AutoMapper Github.

Alt Text

FluentValidation

A small validation library for .NET that uses a fluent interface and lambda expressions for building validation rules.

FluentValidation Github
Nuget: Install-Package FluentValidation -Version 10.3.3

The example below is taken from repository FluentValidation Github.

Alt Text

Swagger

Swagger tooling for APIs built with ASP.NET Core. Generate beautiful API documentation, including a UI to explore and test operations, directly from your routes, controllers and models.

Swagger Github
Nuget: Install-Package Swashbuckle.AspNetCore.Swagger -Version 6.2.2

Alt Text

Alt Text

Top comments (12)

 
seankearon profile image
seankearon

I've done Swagger files by hand before, which isn't much fun. But, I find that generating the Swagger from the code using Swashbuckle is really easy to work with and gives great results.

docs.microsoft.com/en-us/aspnet/co...

What were you using to generate the C# from the Swagger, @sharpninja ?

 
seankearon profile image
seankearon

Thanks. I've never tried generating the C#, but I'll keep in mind that it's not a happy path!

 
jessicanathany profile image
Jéssica Nathany

Yes, example: After you install the library Swagger, you need to configure something in your class Startup.cs and the method Configure you will configure your api, API version, SwaggerEndopoint and API Name. Yes, in answer to your question, its necessary make a to configuration. If you have doubt, yet maybe I can help you about this

Collapse
 
filipjelic profile image
Filip
Collapse
 
jessicanathany profile image
Jéssica Nathany

Yes of course has a lot libraries for .net
Good! I will update this article

Collapse
 
jessicanathany profile image
Jéssica Nathany

Updated, thank you. As I remember more, I will update

Collapse
 
berviantoleo profile image
Bervianto Leo Pratama

Hello. Thank you for this good post. Seems, link to Polly Github is wrong. Currently, navigate to Ocelot.

Collapse
 
jessicanathany profile image
Jéssica Nathany

Oh thanks, I will change here

 
jessicanathany profile image
Jéssica Nathany

I configured normally something I neet to create in "hand"

Collapse
 
jessicanathany profile image
Jéssica Nathany

I use in my work I didn´t have problem

Collapse
 
valihank profile image
Valihan Konurbayev

Nice list, discovered Ocelot for myself. Following are also worth mentioning:

  • AutoFixture
  • Humanizer
Collapse
 
jessicanathany profile image
Jéssica Nathany

Me too, I discovered at the course I made course in .NET its good. So, I had idea to write anything about library, tools and concecpts .NET for don´t forget lol