public IBlobWriter CreateNew(DocumentFormat format, FileNameWithExtension fname)
        {
            var blobId = new BlobId(format, _counterService.GetNext(format));

            if (Logger.IsDebugEnabled)
            {
                Logger.Debug($"CreateNew blob for format {format} with file {fname} - assigned blobId: {blobId}");
            }
            return(new FileSystemBlobWriter(
                       blobId,
                       fname,
                       GetFileNameFromBlobIdAndRemoveDuplicates(blobId, fname),
                       _mongodDbFileSystemBlobDescriptorStorage,
                       Logger));
        }
Exemplo n.º 2
0
        public TIdentity New <TIdentity>()
        {
            var tag = EventStoreIdentity.GetTagForIdentityClass(typeof(TIdentity));
            Func <long, IIdentity> factory = GetFactoryForTag(tag);

            return((TIdentity)factory(_counterService.GetNext(tag)));
        }
        public TIdentity New <TIdentity>()
        {
            var tag = EventStoreIdentity.GetTagForIdentityClass(typeof(TIdentity));

            Func <long, IIdentity> factory;

            if (!_longBasedFactories.TryGetValue(tag, out factory))
            {
                throw new Exception(string.Format("{0} not registered in IdentityManager", tag));
            }
            return((TIdentity)factory(_counterService.GetNext(tag)));
        }
        public IBlobWriter CreateNew(DocumentFormat format, FileNameWithExtension fname)
        {
            var blobId = new BlobId(format, _counterService.GetNext(format));
            var gridFs = GetGridFsByFormat(format);

            Logger.DebugFormat("Creating file {0} on {1}", blobId, gridFs.DatabaseName);
            var stream = gridFs.Create(fname, new MongoGridFSCreateOptions()
            {
                ContentType = MimeTypes.GetMimeType(fname),
                UploadDate  = DateTime.UtcNow,
                Id          = (string)blobId
            });

            return(new BlobWriter(blobId, stream, fname));
        }
Exemplo n.º 5
0
        public IBlobWriter CreateNew(DocumentFormat format, FileNameWithExtension fname)
        {
            var blobId = new BlobId(format, _counterService.GetNext(format));

            return(CreateBlobWriterFromBlobId(format, fname, blobId));
        }
        private DocumentHandle GetAttachHandleFromAttachSource(String attachSource)
        {
            var realAttacHandle = new DocumentHandle(attachSource + "_" + _counterService.GetNext(attachSource));

            return(realAttacHandle);
        }
Exemplo n.º 7
0
        public IBlobWriter CreateNew(DocumentFormat format, FileNameWithExtension fname)
        {
            var blobId = new BlobId(format, _counterService.GetNext(format));

            return(new FileSystemBlobWriter(blobId, fname, GetFileNameFromBlobIdAndRemoveDuplicates(blobId), _blobDescriptorCollection, Logger));
        }
 private DocumentHandle GetAttachHandleFromAttachSource(String attachSource)
 {
     return(new DocumentHandle(attachSource + "_" + _counterService.GetNext(attachSource)));
 }