A .NET wrapper for the REST API of the currency exchange rates of Banca d'Italia (the central bank of Italy).
Use the following command to add the package to a .NET project:
dotnet add package BIExchangeRates.ClientMore options are available on the package page of the NuGet Gallery website.
The console application BIExchangeRates.Console is intended as an example on how to use the REST API wrapper in a real scenario.
The class ExchangeRatesClient is derived from HttpClient that is intended to be instantiated once and re-used throughout the life of an application. Instantiating an ExchangeRatesClient class for every request will exhaust the number of sockets available under heavy loads. This will result in SocketException errors. Below is an example using ExchangeRatesClient correctly.
public class GoodController : ApiController
{
private static readonly ExchangeRatesClient ExchangeRatesClient;
static GoodController()
{
ExchangeRatesClient = new ExchangeRatesClient();
}
}