Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        private static InformationSourceCollection CreateDefaultSources(CloudBlob template)
        {
            InformationSourceCollection sources = InformationSourceCollection.CreateDefault();
            InformationSource           source  = InformationSource.CreateDefault();

            source.SetBlobValuesToSource(template);
            sources.CollectionContent.Add(source);
            return(sources);
        }