/// <summary> /// We have no real Raw storage option for Gridfs, but we can simply store all raw bytes /// inside the gridfs. /// </summary> /// <param name="blobId"></param> /// <param name="descriptor"></param> public void RawStore(BlobId blobId, IBlobDescriptor descriptor) { using (var writer = CreateBlobWriterFromBlobId(blobId.Format, descriptor.FileNameWithExtension, blobId)) using (var inputStream = descriptor.OpenRead()) { inputStream.CopyTo(writer.WriteStream); } }
public void RawStore(BlobId blobId, IBlobDescriptor descriptor) { Logger.InfoFormat("Ask for raw storage of blob {0} for file {1}", blobId, descriptor.FileNameWithExtension); using (var stream = descriptor.OpenRead()) { InnerPersistOfBlob(blobId, descriptor.FileNameWithExtension, stream); FileSystemBlobDescriptor newDescriptor = new FileSystemBlobDescriptor() { BlobId = blobId, ContentType = descriptor.ContentType, FileNameWithExtension = descriptor.FileNameWithExtension, Length = descriptor.Length, Md5 = descriptor.Hash.ToString(), Timestamp = DateTime.UtcNow, }; _mongodDbFileSystemBlobDescriptorStorage.SaveDescriptor(newDescriptor); } }