Best practices to add FluentFTP to IServiceCollection in .NET 6

251 Views Asked by At

I want to use FluentFTP in .NET6. Is there best practice to add FluentFtp.FtpClient to IServiceCollection? Is there any implementation like IHttpClientFactory & AddHttpClient?

I tried the following code. It works but not best.

Some my wrapper

public class MyFtpClient
{
   private readonly FluentFTP.FtpClient _client;

   public MyFtpClient(MyFtpClientSettings settings)
   {
       _client = new FtpClient(); // create instance with settings
   }
}

In Porgram.cs

services.AddScoped(x => new MyFtpClient(settings); 
0

There are 0 best solutions below