Esempio n. 1
0
        public override Blob CreateBlob(Uri id, string extension)
        {
            var sqlBlobModel = new SqlBlobModel
            {
                BlobId = Blob.NewBlobIdentifier(id, extension)
            };

            SqlBlobModelRepository.Save(sqlBlobModel);
            return(GetBlob(sqlBlobModel.BlobId));
        }
Esempio n. 2
0
        public override void Write(Stream stream)
        {
            SqlBlobModel blobModel;

            if ((blobModel = SqlBlobModelRepository.Get(ID)) == null)
            {
                blobModel = new SqlBlobModel
                {
                    BlobId = ID
                };
            }
            var sqlBlobModel = blobModel;

            using (var memoryStream = new MemoryStream())
            {
                stream.CopyTo(memoryStream);
                sqlBlobModel.Blob = memoryStream.ToArray();
            }
            SqlBlobModelRepository.Save(sqlBlobModel);
        }