예제 #1
0
        public Guid Create(XmlDTO entity)
        {
            var            container = BlobStorageHelper.GetBlobContainerFromConfiguration(ContainerConnectionStringName);
            CloudBlockBlob blockBlob = container.GetBlockBlobReference(entity.Id.ToString());

            blockBlob.UploadText(entity.Document.ToString());

            return(entity.Id);
        }
예제 #2
0
        public XmlDTO GetByKey(Guid key)
        {
            var            container = BlobStorageHelper.GetBlobContainerFromConfiguration(ContainerConnectionStringName);
            CloudBlockBlob blockBlob = container.GetBlockBlobReference(key.ToString());

            string xml = blockBlob.DownloadText();

            // strange character appears at the start of xml string
            int startIndex = xml.IndexOf('<');

            if (startIndex > 0)
            {
                xml = xml.Remove(0, startIndex);
            }

            var xDoc = XDocument.Parse(xml);

            return(new XmlDTO {
                Id = key, Document = xDoc
            });
        }