public static Dictionary <string, MediaFolder> GetList(Repository repository) { var container = MediaBlobHelper.InitializeRepositoryContainer(repository); var blobClient = CloudStorageAccountHelper.GetStorageAccount().CreateCloudBlobClient(); var folderBlob = container.GetBlobReference(MediaBlobHelper.MediaDirectoryName); Dictionary <string, MediaFolder> folders = null; try { folderBlob.FetchAttributes(); if (folderBlob.CheckIfMediaFolder()) { var xml = folderBlob.DownloadText(); folders = DataContractSerializationHelper.DeserializeFromXml <Dictionary <string, MediaFolder> >(xml); } } catch { } if (folders == null) { folders = new Dictionary <string, MediaFolder>(); } return(new Dictionary <string, MediaFolder>(folders, StringComparer.OrdinalIgnoreCase)); }
public static Page ToPage(this IPageEntity entity) { if (entity == null) { return(null); } var dummy = new Page(new Site(entity.SiteName), entity.FullName); var page = DataContractSerializationHelper.DeserializeFromXml <Page>(entity.ObjectXml, KnownTypes); ((IPersistable)page).Init(dummy); return(page); }
public static Kooboo.CMS.Sites.Models.User ToUser(this SiteUserEntity entity) { if (entity == null) { return(null); } var dummy = new Kooboo.CMS.Sites.Models.User() { Site = new Site(entity.SiteName), UserName = entity.UserName }; var user = DataContractSerializationHelper.DeserializeFromXml <Kooboo.CMS.Sites.Models.User>(entity.ObjectXml); ((IPersistable)user).Init(dummy); return(user); }
public static ABPageTestResult ToABPageTestResult(this IABPageTestResultEntity entity) { if (entity == null) { return(null); } var dummy = new ABPageTestResult(); dummy.UUID = entity.UUID; dummy.Site = new Site(entity.SiteName); var result = DataContractSerializationHelper.DeserializeFromXml <ABPageTestResult>(entity.ObjectXml, KnownTypes); ((IPersistable)result).Init(dummy); return(result); }
public static ABSiteSetting ToABSiteSetting(this IABSiteSettingEntity entity) { if (entity == null) { return(null); } var dummy = new ABSiteSetting(); dummy.UUID = entity.UUID; dummy.MainSite = entity.SiteName; var result = DataContractSerializationHelper.DeserializeFromXml <ABSiteSetting>(entity.ObjectXml, KnownTypes); ((IPersistable)result).Init(dummy); return(result); }
public static CustomError ToCustomError(this ICustomErrorEntity entity) { if (entity == null) { return(null); } var dummy = new CustomError(); dummy.UUID = entity.UUID; dummy.Site = new Site(entity.SiteName); var customError = DataContractSerializationHelper.DeserializeFromXml <CustomError>(entity.ObjectXml, KnownTypes); ((IPersistable)customError).Init(dummy); return(customError); }
public static Site ToSite(this ISiteSettingEntity entity) { if (entity == null) { return(null); } Site dummy; if (String.IsNullOrWhiteSpace(entity.ParentName)) { dummy = new Site(entity.FullName); } else { dummy = new Site(new Site(entity.ParentName), entity.FullName); } var site = DataContractSerializationHelper.DeserializeFromXml <Site>(entity.ObjectXml, KnownTypes); ((IPersistable)site).Init(dummy); return(site); }
public static UrlRedirect ToUrlRedirect(this IUrlRedirectEntity entity) { if (entity == null) { return(null); } UrlRedirect dummy; if (!String.IsNullOrWhiteSpace(entity.SiteName)) { dummy = new UrlRedirect(new Site(entity.SiteName)); } else { dummy = new UrlRedirect(); } dummy.UUID = entity.UUID; var urlRedirect = DataContractSerializationHelper.DeserializeFromXml <UrlRedirect>(entity.ObjectXml, KnownTypes); ((IPersistable)urlRedirect).Init(dummy); return(urlRedirect); }