コード例 #1
0
 public static async Task <T> GetJsonObject <T>(this IFileStoreService fileStoreService, string bucketName, string fileKey)
 {
     using (var stream = await fileStoreService.GetStream(bucketName, fileKey))
     {
         return(await JsonSerializer.DeserializeAsync <T>(stream));
     }
 }
コード例 #2
0
 public FileRetrievalService(
     IFileStoreService fileStoreService,
     IAmazonS3 s3Client)
 {
     _fileStoreService = fileStoreService;
     _s3Client         = s3Client;
 }
コード例 #3
0
 public static async Task PutLocalFile(this IFileStoreService fileStoreService, string bucketName, string fileKey, string localFilePath)
 {
     using (var fileStream = new FileStream(localFilePath, FileMode.Open))
     {
         await fileStoreService.PutStream(bucketName, fileKey, fileStream);
     }
 }
コード例 #4
0
 public SimpleResizedImageAssetFileService(
     IFileStoreService fileService,
     IQueryExecutor queryExecutor
     )
 {
     _fileService   = fileService;
     _queryExecutor = queryExecutor;
 }
コード例 #5
0
 public GetImageAssetFileByIdQueryHandler(
     IFileStoreService fileStoreService,
     IQueryExecutor queryExecutor
     )
 {
     _fileStoreService = fileStoreService;
     _queryExecutor    = queryExecutor;
 }
コード例 #6
0
 public static async Task PutContent(this IFileStoreService fileStoreService, string bucketName, string fileKey, string content)
 {
     using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(content ?? string.Empty)))
     {
         stream.Seek(0, SeekOrigin.Begin);
         await fileStoreService.PutStream(bucketName, fileKey, stream);
     }
 }
コード例 #7
0
 public GetDocumentAssetFileByIdQueryHandler(
     IFileStoreService fileStoreService,
     CofoundryDbContext dbContext
     )
 {
     _fileStoreService = fileStoreService;
     _dbContext        = dbContext;
 }
コード例 #8
0
 public GetImageAssetFileByIdQueryHandler(
     IFileStoreService fileStoreService,
     IQueryExecutor queryExecutor,
     IImageAssetFileMapper imageAssetFileMapper
     )
 {
     _fileStoreService     = fileStoreService;
     _queryExecutor        = queryExecutor;
     _imageAssetFileMapper = imageAssetFileMapper;
 }
コード例 #9
0
 public static async Task SaveToLocalFile(this IFileStoreService fileStoreService, string bucketName, string fileKey, string localFilePath)
 {
     using (var fileStream = new FileStream(localFilePath, FileMode.CreateNew))
     {
         using (var stream = await fileStoreService.GetStream(bucketName, fileKey))
         {
             await stream.CopyToAsync(fileStream);
         }
     }
 }
コード例 #10
0
 public static async Task <string> GetContent(this IFileStoreService fileStoreService, string bucketName, string fileKey)
 {
     using (var stream = await fileStoreService.GetStream(bucketName, fileKey))
     {
         using (var reader = new StreamReader(stream, Encoding.UTF8))
         {
             return(await reader.ReadToEndAsync());
         }
     }
 }
コード例 #11
0
        public static async Task PutJsonObject <T>(this IFileStoreService fileStoreService, string bucketName, string fileKey, T objectToStore)
        {
            using (var stream = new MemoryStream())
            {
                await JsonSerializer.SerializeAsync(stream, objectToStore);

                stream.Seek(0, SeekOrigin.Begin);
                await fileStoreService.PutStream(bucketName, fileKey, stream);
            }
        }
コード例 #12
0
 public MockImageAssetFileService(
     CofoundryDbContext dbContext,
     IFileStoreService fileStoreService,
     ITransactionScopeManager transactionScopeManager
     )
 {
     _dbContext               = dbContext;
     _fileStoreService        = fileStoreService;
     _transactionScopeManager = transactionScopeManager;
 }
コード例 #13
0
 public DocumentAssetCommandHelper(
     CofoundryDbContext dbContext,
     IFileStoreService fileStoreService,
     ITransactionScopeManager transactionScopeFactory
     )
 {
     _dbContext               = dbContext;
     _fileStoreService        = fileStoreService;
     _transactionScopeFactory = transactionScopeFactory;
 }
コード例 #14
0
 public DocumentController(
     IDocumentService documentService,
     IFileStoreService fileStoreService,
     AppIdentity appIdentity,
     IMapper mapper)
 {
     _documentService  = documentService;
     _fileStoreService = fileStoreService;
     _mapper           = mapper;
     _appIdentity      = appIdentity;
 }
コード例 #15
0
 public ImageSharpImageAssetFileService(
     CofoundryDbContext dbContext,
     IFileStoreService fileStoreService,
     ITransactionScopeManager transactionScopeManager,
     ImageAssetsSettings imageAssetsSettings
     )
 {
     _dbContext               = dbContext;
     _fileStoreService        = fileStoreService;
     _transactionScopeManager = transactionScopeManager;
     _imageAssetsSettings     = imageAssetsSettings;
 }
コード例 #16
0
 public ImageSharpResizedImageAssetFileService(
     IFileStoreService fileService,
     IQueryExecutor queryExecutor,
     ImageAssetsSettings imageAssetsSettings,
     ILogger <ImageSharpResizedImageAssetFileService> logger
     )
 {
     _fileService         = fileService;
     _queryExecutor       = queryExecutor;
     _logger              = logger;
     _imageAssetsSettings = imageAssetsSettings;
 }
コード例 #17
0
 public DeleteDocumentAssetCommandHandler(
     CofoundryDbContext dbContext,
     ICommandExecutor commandExecutor,
     ITransactionScopeManager transactionScopeFactory,
     IMessageAggregator messageAggregator,
     IFileStoreService fileStoreService
     )
 {
     _dbContext               = dbContext;
     _commandExecutor         = commandExecutor;
     _transactionScopeFactory = transactionScopeFactory;
     _messageAggregator       = messageAggregator;
     _fileStoreService        = fileStoreService;
 }
コード例 #18
0
 public DocumentAssetCommandHelper(
     CofoundryDbContext dbContext,
     IFileStoreService fileStoreService,
     ITransactionScopeManager transactionScopeFactory,
     IMimeTypeService mimeTypeService,
     IAssetFileTypeValidator assetFileTypeValidator
     )
 {
     _dbContext               = dbContext;
     _fileStoreService        = fileStoreService;
     _transactionScopeFactory = transactionScopeFactory;
     _mimeTypeService         = mimeTypeService;
     _assetFileTypeValidator  = assetFileTypeValidator;
 }
コード例 #19
0
 public CleanUpAssetFilesCommandHandler(
     IDistributedLockManager distributedLockManager,
     CofoundryDbContext dbContext,
     IFileStoreService fileStoreService,
     IResizedImageAssetFileService resizedImageAssetFileService,
     AssetFileCleanupSettings assetFileCleanupSettings,
     ILogger <CleanUpAssetFilesCommandHandler> logger
     )
 {
     _distributedLockManager = distributedLockManager;
     _dbContext                    = dbContext;
     _fileStoreService             = fileStoreService;
     _resizedImageAssetFileService = resizedImageAssetFileService;
     _assetFileCleanupSettings     = assetFileCleanupSettings;
     _logger = logger;
 }
コード例 #20
0
        public AlbumControllerTests()
        {
            _albums = new List<Album>();

            for (int i = 1; i <= 5; i++)
            {
                var album = new Album()
                                {
                                    ID = i

                                };

                _albums.Add(album);
            }

            var mockFileStoreService = new Mock<IFileStoreService>();
            _fileStoreService = mockFileStoreService.Object;
        }
コード例 #21
0
 public DeleteImageAssetCommandHandler(
     CofoundryDbContext dbContext,
     IImageAssetCache imageAssetCache,
     ICommandExecutor commandExecutor,
     ITransactionScopeManager transactionScopeFactory,
     IMessageAggregator messageAggregator,
     IFileStoreService fileStoreService,
     IResizedImageAssetFileService resizedImageAssetFileService
     )
 {
     _dbContext                    = dbContext;
     _imageAssetCache              = imageAssetCache;
     _commandExecutor              = commandExecutor;
     _transactionScopeFactory      = transactionScopeFactory;
     _messageAggregator            = messageAggregator;
     _fileStoreService             = fileStoreService;
     _resizedImageAssetFileService = resizedImageAssetFileService;
 }
コード例 #22
0
 public DeleteFileHandler(IFileStoreService fileStoreService, IMapper mapper)
 {
     _fileStoreService = fileStoreService;
     _mapper           = mapper;
 }
コード例 #23
0
 public AlbumController(IAlbumService albumService, IFileStoreService fileStoreService)
 {
     _albumService = albumService ?? new AlbumService(new AlbumRepository());
     _fileStoreService = fileStoreService ?? new FileStoreService();
 }
コード例 #24
0
 public DownloadFileHandler(IFileStoreService fileStoreService)
 {
     _fileStoreService = fileStoreService;
 }
コード例 #25
0
ファイル: UploadFile.cs プロジェクト: pdelaplana/overture
 public UploadFileHandler(IFileStoreService fileStoreService, IMapper mapper)
 {
     _fileStoreService = fileStoreService;
     _mapper           = mapper;
 }