当前位置: 首页>>代码示例>>C#>>正文


C# SyndicationItem.GetAtom10Formatter方法代码示例

本文整理汇总了C#中System.ServiceModel.Syndication.SyndicationItem.GetAtom10Formatter方法的典型用法代码示例。如果您正苦于以下问题:C# SyndicationItem.GetAtom10Formatter方法的具体用法?C# SyndicationItem.GetAtom10Formatter怎么用?C# SyndicationItem.GetAtom10Formatter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ServiceModel.Syndication.SyndicationItem的用法示例。


在下文中一共展示了SyndicationItem.GetAtom10Formatter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddEntry

 public SyndicationItem AddEntry(Uri feedUri, SyndicationItem newEntry)
 {
     if (feedUri == null)
     {
         throw new ArgumentNullException("feedUri");
     }
     if (newEntry == null)
     {
         throw new ArgumentNullException("newEntry");
     }
     return this.Post(feedUri, AtomEntryContentType, HttpContentExtensions.CreateDataContract(newEntry.GetAtom10Formatter())).EnsureStatusIs(HttpStatusCode.Created).Content.ReadAsDataContract<Atom10ItemFormatter>().Item;
 }
开发者ID:pusp,项目名称:o2platform,代码行数:12,代码来源:AtomPubClient.cs

示例2: GetEntry

    public AtomEntry GetEntry(Id entryId)
    {
      ItemDataContext dc = new ItemDataContext();
      Item item = dc.Items.Where(i => i.Id == entryId.ToString()).SingleOrDefault();
      SyndicationItem si = new SyndicationItem()
      {
        Id = item.Id,
        LastUpdatedTime = item.LastUpdatedTime,
        PublishDate = item.PublishDate.Value
      };
      if (!string.IsNullOrEmpty(item.BaseUri)) si.BaseUri = new Uri(item.BaseUri);

      LoadAttributes(si.AttributeExtensions, item.Attributes);
      LoadElements(si.ElementExtensions, item.Elements);
      LoadPersons(si.Authors, item.Persons, PersonTypeAuthor);
      LoadPersons(si.Contributors, item.Persons, PersonTypeContributor);
      si.Content = GetContent(item.Content);
      si.Title = GetTextContent(item.Title);
      si.Summary = GetTextContent(item.Summary);
      si.Copyright = GetTextContent(item.Copyright);
      LoadLinks(si.Links, item.Links);
      LoadCategories(si.Categories, item.Categories);

      using (Stream s = new MemoryStream())
      {
        XmlWriter w = new XmlTextWriter(s, Encoding.UTF8);
        si.GetAtom10Formatter().WriteTo(w);
        w.Flush();
        AtomEntry entry = new AtomEntry();
        s.Position = 0;
        XmlReader r = new XmlTextReader(s);
        entry.Xml = XElement.Load(r);
        //entry.ReadXml(r);
        return entry;
      }
    }
开发者ID:erikzaadi,项目名称:atomsitethemes.erikzaadi.com,代码行数:36,代码来源:DlinqAtomEntryRepository.cs

示例3: GetPost

        public HttpResponseMessage GetPost(string id, HttpRequestMessage request)
        {
            var post = _postManager.Get(id);
            if (post == null)
            {
                return new HttpResponseMessage()
                {
                    StatusCode = HttpStatusCode.NotFound
                };
            }

            if (request.AcceptsHtml())
            {
                return new HttpResponseMessage()
                {
                    StatusCode = HttpStatusCode.OK,
                    Content = new ObjectContent(typeof(Post), post, new List<MediaTypeFormatter>() { new PostHtmlMediaTypeFormatter() })
                };
            }
            else if (request.AcceptsAtom())
            {
                var item = new SyndicationItem()
                {
                    Id = post.Id,
                    Title = new TextSyndicationContent(post.Title),
                    LastUpdatedTime = post.LastUpdatedTime,
                    Content = new TextSyndicationContent(post.Content)
                };
                return new HttpResponseMessage()
                {
                    StatusCode = HttpStatusCode.OK,
                    Content = new ObjectContent(typeof(Atom10ItemFormatter), item.GetAtom10Formatter())
                };
            }
            else
            {
                return new HttpResponseMessage()
                {
                    StatusCode = HttpStatusCode.InternalServerError
                };
            }
        }
开发者ID:sandrapatfer,项目名称:PROMPT11-06-Services.sandrapatfer,代码行数:42,代码来源:BlogEngineService.cs

示例4: UpdateEntry

 public SyndicationItem UpdateEntry(Uri editUri, SyndicationItem newValue)
 {
     if (editUri == null)
     {
         throw new ArgumentNullException("editUri");
     }
     if (newValue == null)
     {
         throw new ArgumentNullException("newValue");
     }
     return this.Put(editUri, AtomEntryContentType, HttpContentExtensions.CreateDataContract(newValue.GetAtom10Formatter())).EnsureStatusIs(HttpStatusCode.OK).Content.ReadAsDataContract<Atom10ItemFormatter>().Item;
 }
开发者ID:pusp,项目名称:o2platform,代码行数:12,代码来源:AtomPubClient.cs


注:本文中的System.ServiceModel.Syndication.SyndicationItem.GetAtom10Formatter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。