public void ConfigureServices(IServiceCollection services) { var configuration = Fx.Construction.Configuration; var options = new AliyunOSSClientOptions(); configuration.GetSection(nameof(AliyunOSSClientOptions)).Bind(options); services.AddSingleton(sp => new OssClient(options.EndPoint, options.AccessKeyId, options.AccessKeySecret)); services.AddSingleton <IOSSClient>(sp => new AliyunOSSClient(sp.GetRequiredService <OssClient>(), options)); }
public AliyunOSSClient(IOss client, AliyunOSSClientOptions options) { _client = client; _options = options; }