private static ContentNodeKit CreateContentNodeKit(ContentSourceDto dto) { ContentData d = null; ContentData p = null; if (dto.Edited) { if (dto.EditData == null) { if (Debugger.IsAttached) { throw new Exception("Missing cmsContentNu edited content for node " + dto.Id + ", consider rebuilding."); } Current.Logger.Warn <DatabaseDataSource>("Missing cmsContentNu edited content for node {NodeId}, consider rebuilding.", dto.Id); } else { var nested = DeserializeNestedData(dto.EditData); d = new ContentData { Name = dto.EditName, Published = false, TemplateId = dto.EditTemplateId, VersionId = dto.VersionId, VersionDate = dto.EditVersionDate, WriterId = dto.EditWriterId, Properties = nested.PropertyData, CultureInfos = nested.CultureData }; } } if (dto.Published) { if (dto.PubData == null) { if (Debugger.IsAttached) { throw new Exception("Missing cmsContentNu published content for node " + dto.Id + ", consider rebuilding."); } Current.Logger.Warn <DatabaseDataSource>("Missing cmsContentNu published content for node {NodeId}, consider rebuilding.", dto.Id); } else { var nested = DeserializeNestedData(dto.PubData); p = new ContentData { Name = dto.PubName, UrlSegment = nested.UrlSegment, Published = true, TemplateId = dto.PubTemplateId, VersionId = dto.VersionId, VersionDate = dto.PubVersionDate, WriterId = dto.PubWriterId, Properties = nested.PropertyData, CultureInfos = nested.CultureData }; } } var n = new ContentNode(dto.Id, dto.Uid, dto.Level, dto.Path, dto.SortOrder, dto.ParentId, dto.CreateDate, dto.CreatorId); var s = new ContentNodeKit { Node = n, ContentTypeId = dto.ContentTypeId, DraftData = d, PublishedData = p }; return(s); }
private ContentNodeKit CreateContentNodeKit(ContentSourceDto dto, IContentCacheDataSerializer serializer) { ContentData d = null; ContentData p = null; if (dto.Edited) { if (dto.EditData == null && dto.EditDataRaw == null) { if (Debugger.IsAttached) { throw new InvalidOperationException("Missing cmsContentNu edited content for node " + dto.Id + ", consider rebuilding."); } Current.Logger.Warn <DatabaseDataSource, int>("Missing cmsContentNu edited content for node {NodeId}, consider rebuilding.", dto.Id); } else { var deserializedContent = serializer.Deserialize(dto, dto.EditData, dto.EditDataRaw); d = new ContentData { Name = dto.EditName, Published = false, TemplateId = dto.EditTemplateId, VersionId = dto.VersionId, VersionDate = dto.EditVersionDate, WriterId = dto.EditWriterId, Properties = deserializedContent.PropertyData, // TODO: We don't want to allocate empty arrays CultureInfos = deserializedContent.CultureData, UrlSegment = deserializedContent.UrlSegment }; } } if (dto.Published) { if (dto.PubData == null && dto.PubDataRaw == null) { if (Debugger.IsAttached) { throw new InvalidOperationException("Missing cmsContentNu published content for node " + dto.Id + ", consider rebuilding."); } Current.Logger.Warn <DatabaseDataSource, int>("Missing cmsContentNu published content for node {NodeId}, consider rebuilding.", dto.Id); } else { var deserializedContent = serializer.Deserialize(dto, dto.PubData, dto.PubDataRaw); p = new ContentData { Name = dto.PubName, UrlSegment = deserializedContent.UrlSegment, Published = true, TemplateId = dto.PubTemplateId, VersionId = dto.VersionId, VersionDate = dto.PubVersionDate, WriterId = dto.PubWriterId, Properties = deserializedContent.PropertyData, // TODO: We don't want to allocate empty arrays CultureInfos = deserializedContent.CultureData }; } } var n = new ContentNode(dto.Id, dto.Key, dto.Level, dto.Path, dto.SortOrder, dto.ParentId, dto.CreateDate, dto.CreatorId); var s = new ContentNodeKit { Node = n, ContentTypeId = dto.ContentTypeId, DraftData = d, PublishedData = p }; return(s); }