private static InformationSource GetMissingRootAsNewSource(ContentItem root, string masterLocation, out bool foundExistingSource) { InformationSource source = root.Source ?? InformationSource.CreateDefault(); IInformationObject informationObject = (IInformationObject)root.RootObject; if (informationObject == null) { foundExistingSource = false; return(null); } string sourceContentLocation = informationObject.GetLocationRelativeToContentRoot(masterLocation, root.RootName); CloudBlob blob; IInformationObject existingObject = StorageSupport.RetrieveInformationWithBlob(sourceContentLocation, root.RootType, out blob); if (existingObject == null) { informationObject.SetLocationRelativeToContentRoot(masterLocation, root.RootName); blob = StorageSupport.StoreInformation(informationObject); foundExistingSource = false; } else { informationObject = existingObject; root.RootObject = existingObject; foundExistingSource = true; } source.SetBlobValuesToSource(blob); source.SetInformationObjectValuesToSource(root.RootName, informationObject.GetType().FullName); source.IsDynamic = root.IsDynamicRoot; return(source); }
public IInformationObject RetrieveInformationObject() { if (String.IsNullOrEmpty(SourceInformationObjectType)) { return(null); } CloudBlob blob; IInformationObject content = StorageSupport.RetrieveInformationWithBlob(SourceLocation, SourceInformationObjectType, out blob); SourceETag = content.ETag; SourceMD5 = blob.Properties.ContentMD5; SourceLastModified = blob.Properties.LastModifiedUtc; return(content); }