protected SyndicationContent GetContent(Content content) { SyndicationContent sc = null; if (content != null) { if (!string.IsNullOrEmpty(content.Url)) { sc = new UrlSyndicationContent( !string.IsNullOrEmpty(content.Url) ? null : new Uri(content.Url), content.Type); } if (string.IsNullOrEmpty(content.Type) || content.Type == "xhtml" || content.Type == "html" || content.Type == "text") { sc = new TextSyndicationContent(content.Text, (string.IsNullOrEmpty(content.Type) || content.Type == "text") ? TextSyndicationContentKind.Plaintext : content.Type == "xhtml" ? TextSyndicationContentKind.XHtml : TextSyndicationContentKind.Html); } else { sc = new XmlSyndicationContent(content.Type, new SyndicationElementExtension(new XmlTextReader(new StringReader(content.Text)))); } LoadAttributes(sc.AttributeExtensions, content.Attributes); } return sc; }
protected TextSyndicationContent GetTextContent(Content content) { if (content == null) return null; return new TextSyndicationContent(content.Text, (string.IsNullOrEmpty(content.Type) || content.Type == "text") ? TextSyndicationContentKind.Plaintext : content.Type == "xhtml" ? TextSyndicationContentKind.XHtml : TextSyndicationContentKind.Html); }
partial void DeleteContent(Content instance);
partial void UpdateContent(Content instance);
partial void InsertContent(Content instance);
protected Content CreateTextContent(TextSyndicationContent sc) { if (sc == null) return null; Content content = new Content() { Text = sc.Text, Type = sc.Type }; content.Attributes.AddRange(sc.AttributeExtensions.Select(ae => new Attribute() { Name = ae.Key.Name, Namespace = ae.Key.Namespace, Value = ae.Value })); dc.Contents.InsertOnSubmit(content); return content; }