Example #1
0
        /// <summary>
        /// config aliyun oss
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="optionsAction"></param>
        /// <returns></returns>
        public static IServiceCollection AddAliyunOss(this IServiceCollection builder, Action <AliyunOssOptions> optionsAction)
        {
            var options = new AliyunOssOptions();

            optionsAction.Invoke(options);
            builder.AddTransient <AliyunOssOptions>((_) => options);
            builder.AddSingleton <AliyunOssClient>((provider => new AliyunOssClient(options)));
            return(builder);
        }
Example #2
0
 public AliyunOssClient(AliyunOssOptions options)
 {
     this._imageBulkName = options.BulkName;
     this._ossClient     = new OssClient(options.RemoteEndPoint, options.AccessKeyId, options.AccessKeySecret);
     this._options       = options;
 }