private IFileStoreClient GetClient(string code, Patch patch) { IFileStoreClient client = null; //选择上传的客户端 var services = _provider.GetServices <IFileStoreClient>(); if (patch.StoreType == (int)StoreType.S3) { client = services.FirstOrDefault(x => x is S3FileStoreClient); } else if (patch.StoreType == (int)StoreType.FastDFS) { client = services.FirstOrDefault(x => x is FastDFSFileStoreClient); } if (client == null) { throw new ArgumentException($"未找到存储客户端,医院编码:{code},存储类型:{patch.StoreType.ToString()}"); } return(client); }
public FileController(IFileStoreClient fileStoreClient) { _fileStoreClient = fileStoreClient; }