• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Syndication.SyndicationFeed类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



SyndicationFeed类属于System.ServiceModel.Syndication命名空间,在下文中一共展示了SyndicationFeed类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TransformFeed

 public void TransformFeed(SyndicationFeed feed, SyndicationVisitorContext context)
 {
     if (feed.Links.Any())
     {
         feed.Links[0] = new SyndicationLink(context.RssUrl, "alternate", title: null, mediaType: null, length: 0);
     }
 }
开发者ID:swegner,项目名称:tbot-rss,代码行数:7,代码来源:ReplaceLink.cs


示例2: GetService

        public async Task<IHttpActionResult> GetService(string id)
        {
            Service service = await db.Services.FindAsync(id);
            if (service == null)
            {
                return NotFound();
            }

            var ServiceFeed = new SyndicationFeed();
            ServiceFeed.Id = service.Id;
            ServiceFeed.LastUpdatedTime = service.Updated;
            ServiceFeed.Title = new TextSyndicationContent(service.Title);
            ServiceFeed.Description = new TextSyndicationContent(service.Summary);

            ServiceFeed.Categories.Add(new SyndicationCategory(service.ServiceCategoryId.ToString(), null, service.Category.Name));

            var SelfLink = new SyndicationLink();
            SelfLink.RelationshipType = "self";
            SelfLink.Uri = new Uri(Url.Content("~/Service/" + service.Id));
            SelfLink.MediaType = "application/atom+xml";
            ServiceFeed.Links.Add(SelfLink);

            var HtmlLink = new SyndicationLink();
            HtmlLink.RelationshipType = "self";
            HtmlLink.Uri = new Uri("http://surreyhillsdc.azurewebsites.net/");
            HtmlLink.MediaType = "text/html";
            ServiceFeed.Links.Add(HtmlLink);

            return Ok(ServiceFeed.GetAtom10Formatter());
        }
开发者ID:BforBen,项目名称:OpenGovApi,代码行数:30,代码来源:ServiceController.cs


示例3: GetSyndicationFeed

        /// <summary>
        /// Turn a SimpleFeed object into a SyndicationFeed object
        /// </summary>
        private SyndicationFeed GetSyndicationFeed(SimpleFeed pFeed)
        {
            var feed = new SyndicationFeed();
            var items = new List<SyndicationItem>();

            feed.BaseUri = new Uri(pFeed.BaseUrl);
            if (!string.IsNullOrWhiteSpace(pFeed.Title))
                feed.Title = new TextSyndicationContent(pFeed.Title);
            if (!string.IsNullOrWhiteSpace(pFeed.Description))
                feed.Description = new TextSyndicationContent(pFeed.Description);
            if (!string.IsNullOrWhiteSpace(pFeed.Language))
                feed.Language = pFeed.Language;

            if (pFeed.Entries != null)
            {
                foreach (var entry in pFeed.Entries)
                {
                    var item = new SyndicationItem(entry.Title, entry.Body, entry.TitleLinkUri);
                    //Id, DatePublished, DateLastUpdated are required so that each new post won't make readers think that every entry is new
                    item.Id = entry.Id;
                    item.PublishDate = entry.DatePublished;
                    item.LastUpdatedTime = entry.DateLastUpdated;
                    item.BaseUri = entry.TitleLinkUri;
                    items.Add(item);
                }
            }

            feed.Items = items;
            return feed;
        }
开发者ID:akmurray,项目名称:aaronkmurray-blog-tools,代码行数:33,代码来源:SimpleFeedConverter.cs


示例4: ActivityFeed

        public ActionResult ActivityFeed(string name, int id)
        {
            var polfeed = _polRep.LatestFeed(id, includeposts);
            List<SyndicationItem> items = new List<SyndicationItem>();
            var pol = _polRep.GetPoliticianById(id);
            var polLink = this.Request.Url.GetLeftPart(UriPartial.Authority) + pol.PolLink(this);

            SyndicationFeed feed =
                new SyndicationFeed(
                        String.Format("{0} Feed", pol.FullName()), "Activity Feed på Folkets Ting",
                        new Uri(Request.Url.ToString()),
                        Request.Url.AbsoluteUri,
                        polfeed.Last().date);

            foreach (var feeditem in polfeed)
            {
                var link = (this.Request.Url.GetLeftPart(UriPartial.Authority) + feeditem.ActionUrl);
                SyndicationItem item =
                    new SyndicationItem(feeditem.ActionText,
                                    feeditem.BodyText,
                                    new Uri(link),
                                    feeditem.ActionUrl + feeditem.ActionText,
                                    feeditem.date);
                items.Add(item);
            }
            feed.Items = items;

            return new RssActionResult() { Feed = feed };
        }
开发者ID:friism,项目名称:folketsting,代码行数:29,代码来源:PoliticianController.cs


示例5: GlobalEquityWindow

        public GlobalEquityWindow()
        {
            this.InitializeComponent();

            Image img = Properties.Resources.standardandpoors;
            this.logoBox.Image = img;

            this.dataExtraction = new DataExtraction();
            this.feedCondent = new SyndicationFeed();
            this.links = new Dictionary<DateTime, string>();

            this.feedCondent = this.dataExtraction.GetRssFeedData("https://us.spindices.com/rss/rss-details/?rssFeedName=global-equity");
            if (this.feedCondent != null)
            {
                Tuple<DataGridView, Dictionary<DateTime, string>> parsedContent =
                    this.dataExtraction.ParseRssFeedData(this.feedCondent);

                foreach (DataGridViewRow row in parsedContent.Item1.Rows)
                {
                    int rowId = this.dataGridContent.Rows.Add();
                    this.dataGridContent.Rows[rowId].Cells[0].Value = row.Cells[0].Value;
                    this.dataGridContent.Rows[rowId].Cells[1].Value = row.Cells[1].Value;
                    this.dataGridContent.Rows[rowId].Cells[2].Value = row.Cells[2].Value;
                }

                this.links = parsedContent.Item2;
            }

            this.dataGridContent.Sort(this.dataGridContent.Columns[0], ListSortDirection.Descending);
        }
开发者ID:victor-velchev,项目名称:CSharp,代码行数:30,代码来源:GlobalEquityWindow.cs


示例6: Build

        public string Build(FeedData dataFeed, Uri baseUri)
        {
            var feed = new SyndicationFeed
            {
                Id = dataFeed.Id.ToString(),
                LastUpdatedTime = dataFeed.DateCreated,
                Items = dataFeed.Messages.Select(x => new SyndicationItem
                {
                    Content = new RawSyndicationContent(x.Body),
                    Id = x.Id.ToString(),
                    LastUpdatedTime = x.CreatedAt
                })
            };

            if (!string.IsNullOrEmpty(dataFeed.NextUri))
                feed.Links.Add(new SyndicationLink(new Uri(baseUri, dataFeed.NextUri), NextInArchiveRelationshipType,
                    "Next In Archive", ContentType, 0));

            if (!string.IsNullOrEmpty(dataFeed.PreviousUri))
                feed.Links.Add(new SyndicationLink(new Uri(baseUri, dataFeed.PreviousUri), PrevInArchiveRelationshipType,
                    "Previous In Archive", ContentType, 0));

            var formatter = new Atom10FeedFormatter(feed);

            var sw = new StringWriter();
            using (var writer = XmlWriter.Create(sw))
            {
                formatter.WriteTo(writer);
            }

            return sw.ToString();
        }
开发者ID:peterbeams,项目名称:SimpleAtomPubSub,代码行数:32,代码来源:AtomFormatter.cs


示例7: CreateFeed

        public SyndicationFeedFormatter CreateFeed()
        {
            // Create a new Syndication Feed.
            SyndicationFeed feed = new SyndicationFeed("Feed Title", "A WCF Syndication Feed", null);
            List<SyndicationItem> items = new List<SyndicationItem>();

            // Create a new Syndication Item.
            SyndicationItem item = new SyndicationItem("An item", "Item content", null);
            items.Add(item);
            feed.Items = items;

            // Return ATOM or RSS based on query string
            // rss -> http://localhost:8733/Design_Time_Addresses/SyndicationServiceLibrary1/Feed1/
            // atom -> http://localhost:8733/Design_Time_Addresses/SyndicationServiceLibrary1/Feed1/?format=atom
            string query = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["format"];
            SyndicationFeedFormatter formatter = null;
            if (query == "atom")
            {
                formatter = new Atom10FeedFormatter(feed);
            }
            else
            {
                formatter = new Rss20FeedFormatter(feed);
            }

            return formatter;
        }
开发者ID:hkuntal,项目名称:MySociety,代码行数:27,代码来源:Feed1.cs


示例8: CreateFeed

        public SyndicationFeedFormatter CreateFeed()
        {
            // Créez un flux RSS.
            SyndicationFeed feed = new SyndicationFeed("Bug Track", "Flux rss du bug track", null);
            List<SyndicationItem> items = new List<SyndicationItem>();

            // Créez un article RSS.
            List<DBO.Bug> bugs = DataAccess.Bug.GetLastBug(10);
            bugs.ForEach(bug => items.Add(new SyndicationItem(bug.Title, bug.Details, null)));

            feed.Items = items;

            // Renvoie ATOM ou RSS en fonction de la chaîne de requête
            // rss -> http://localhost:8733/Design_Time_Addresses/SyndicationServiceBugTrack/Feed1/
            // atom -> http://localhost:8733/Design_Time_Addresses/SyndicationServiceBugTrack/Feed1/?format=atom
            string query = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["format"];
            SyndicationFeedFormatter formatter = null;
            if (query == "atom")
            {
                formatter = new Atom10FeedFormatter(feed);
            }
            else
            {
                formatter = new Rss20FeedFormatter(feed);
            }

            return formatter;
        }
开发者ID:ThomasCOLLIN,项目名称:TPs,代码行数:28,代码来源:Feed1.cs


示例9: SyndicationFeedActionResult

        public SyndicationFeedActionResult(SyndicationFeed result)
        {
            if (result == null)
                throw new ArgumentNullException("result");

            Result = result;
        }
开发者ID:kimbirkelund,项目名称:EztvFeedProxy,代码行数:7,代码来源:SyndicationFeedActionResult.cs


示例10: CreateFeed

        public SyndicationFeedFormatter CreateFeed()
        {
            // Créez un flux RSS.
            SyndicationFeed feed = new SyndicationFeed("TekConf Event", "Last 10 event added in TekConf", null);
            List<SyndicationItem> items = TekConf.DataAccess.Event.GetLastEventsList(10).Select(
                e => new SyndicationItem("idEvent :  " + e.id + " : " + e.name,
                    e.location + ", " + e.time + " \n " + e.Technology + " \n " + e.description,
                    null)
                ).ToList();
            feed.Items = items;

            // Renvoie ATOM ou RSS en fonction de la chaîne de requête
            // rss -> http://localhost:8733/Design_Time_Addresses/SyndicationServiceLibrary1/Feed1/
            // atom -> http://localhost:8733/Design_Time_Addresses/SyndicationServiceLibrary1/Feed1/?format=atom
            string query = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["format"];
            SyndicationFeedFormatter formatter = null;
            if (query == "atom")
            {
                formatter = new Atom10FeedFormatter(feed);
            }
            else
            {
                formatter = new Rss20FeedFormatter(feed);
            }

            return formatter;
        }
开发者ID:camilleblondie,项目名称:tekconf,代码行数:27,代码来源:Feed1.cs


示例11: WriteXml

		internal override void WriteXml(XmlWriter writer, SyndicationFeed feed)
		{
			writer.WriteStartElement(FeedName, FeedNamespace);

			if (!String.IsNullOrEmpty(feed.Language))
					writer.WriteAttributeString("xml:lang", feed.Language);

			WriteXml(writer, feed.Title, "title", true);
			writer.WriteElementString("id", feed.Id);
			WriteXml(writer, feed.Copyright, "rights");

			string updated = feed.LastUpdatedTime.ToUniversalTime().ToString("s");
			writer.WriteElementString("updated", updated + "Z");

			if (feed.ImageUrl != null)
				writer.WriteElementString("logo", feed.ImageUrl.ToString());

			if (!String.IsNullOrEmpty(feed.Generator))
				writer.WriteElementString("generator", feed.Generator);

			WriteXml(writer, feed.Description, "summary");

			foreach (SyndicationItem item in feed.Items)
				{
					WriteTo(writer, item);
				}

			writer.WriteEndElement();
		}
开发者ID:nickchal,项目名称:pash,代码行数:29,代码来源:Atom10Serializer.cs


示例12: Write

		/// <summary>
		/// Executes the syndication result on the given context.
		/// </summary>
		/// <param name="context">The current context.</param>
		public virtual void Write(IStreamResponse response) {
			var writer = new XmlTextWriter(response.OutputStream, Encoding.UTF8);
			var ui = new Client.Helpers.UIHelper();

			// Write headers
			response.ContentType = ContentType;
			response.ContentEncoding = Encoding.UTF8;

			var feed = new SyndicationFeed() { 
				Title = new TextSyndicationContent(Config.Site.Title),
				LastUpdatedTime = Posts.First().Published.Value,
				Description = new TextSyndicationContent(Config.Site.Description),
			};
			feed.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(App.Env.AbsoluteUrl("~/"))));

			var items = new List<SyndicationItem>();
			foreach (var post in Posts) {
				var item = new SyndicationItem() { 
					Title = SyndicationContent.CreatePlaintextContent(post.Title),
					PublishDate = post.Published.Value,
					Summary = SyndicationContent.CreateHtmlContent(post.Body)
				};
				item.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(App.Env.AbsoluteUrl("~/" + post.Type.Slug + "/" + post.Slug))));
				items.Add(item);
			}
			feed.Items = items;

			var formatter = GetFormatter(feed);
			formatter.WriteTo(writer);

			writer.Flush();
			writer.Close();
		}
开发者ID:cdie,项目名称:Piranha.vNext,代码行数:37,代码来源:PostFeed.cs


示例13: Rss

        public ActionResult Rss(string domain="")
        {
            var news = NewsProvider.GetSeason(2014, domain).OrderByDescending(n=>n.Date).Take(10);

            var feedItems = new List<SyndicationItem>();
            foreach (var news_item in news)
            {
                var item = new SyndicationItem()
                {
                    Title = TextSyndicationContent.CreatePlaintextContent(news_item.Title),
                    PublishDate = new DateTimeOffset(news_item.Date),
                    Summary = TextSyndicationContent.CreateHtmlContent(CombineBriefWithImage(news_item)),
                };
                string url = "http://afspb.org.ru/news/" + news_item.Slug;

                var link = new SyndicationLink(new Uri(url));
                link.Title = "Перейти к новости";
                item.Links.Add(link);
                feedItems.Add(item);
            }

            var feed = new SyndicationFeed(
                    "Новости сайта Автомобильной Федерации Санкт-Петербурга и Ленинградской области",
                    "",
                    new Uri("http://afspb.org.ru/news/Rss"),
                    feedItems);

            return new RssResult()
            {
                Feed = feed
            };
        }
开发者ID:rallysportphoto,项目名称:Portal,代码行数:32,代码来源:NewsController.cs


示例14: CreateFeedForBlog

        public SyndicationFeedFormatter CreateFeedForBlog(string user, string blog)
        {
            SyndicationFeed feed = new SyndicationFeed("Blog feed", "A feed linked to a blog", null);
            List<SyndicationItem> items = new List<SyndicationItem>();
            List<Dbo.RssArticle> articles = BusinessManagement.Feed.GetBlogContent(user, blog);

            foreach (Dbo.RssArticle article in articles)
            {
                SyndicationItem item = new SyndicationItem(article.Title, article.Content, null);
                item.PublishDate = article.CreationDate;
                items.Add(item);
            }
            feed.Items = items;

            // Renvoie ATOM ou RSS en fonction de la chaîne de requête
            // rss -> http://localhost:8733/Design_Time_Addresses/FluxRss/Feed1/
            // atom -> http://localhost:8733/Design_Time_Addresses/FluxRss/Feed1/?format=atom
            string query = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["format"];
            SyndicationFeedFormatter formatter = null;
            if (query == "atom")
            {
                formatter = new Atom10FeedFormatter(feed);
            }
            else
            {
                formatter = new Rss20FeedFormatter(feed);
            }

            return formatter;
        }
开发者ID:ThomasCOLLIN,项目名称:dotNET,代码行数:30,代码来源:Feed.cs


示例15: FeedActionResult

        /// <summary>
        /// Initializes a new instance of the FeedActionResult class
        /// </summary>
        /// <param name="blogName">Name of the blog</param>
        /// <param name="description">Feed description</param>
        /// <param name="format">Format of the feed</param>
        /// <param name="url">A URL Helper</param>
        /// <param name="posts">The posts to include in the feed</param>
        public FeedActionResult(string blogName, string description, FeedFormat format, UrlHelper url, IEnumerable<BlogPost> posts)
        {
            Guid blogPostId;
            string postRelative;
            SyndicationItem item;
            List<SyndicationItem> items = new List<SyndicationItem>();

            // Specify the type of feed
            Format = format;

            // Initialize the current feed
            Feed = new SyndicationFeed(blogName, description, new Uri(url.RouteUrl("Default"), UriKind.Relative));

            //load the posts as items
            foreach (BlogPost post in posts)
            {
                blogPostId = post.BlogPostId;
                postRelative = url.Action(
                    "Details", "Posts",
                    new
                    {
                        year = post.PostedDate.Value.Year,
                        month = post.PostedDate.Value.Month,
                        day = post.PostedDate.Value.Day,
                        id = blogPostId
                    });

                item = new SyndicationItem(post.Title, post.Post,
                    new Uri(postRelative, UriKind.Relative), post.BlogPostId.ToString(), post.PostedDate.Value);

                items.Add(item);
            }

            Feed.Items = items.OrderByDescending(x => x.LastUpdatedTime);
        }
开发者ID:senfo,项目名称:FrogBlogger,代码行数:43,代码来源:FeedActionResult.cs


示例16: GetProcesses

        public SyndicationFeedFormatter GetProcesses(string format)
        {
            IEnumerable<Process> processes = new List<Process>( Process.GetProcesses() );

            //SyndicationFeed also has convenience constructors
            //that take in common elements like Title and Content.
            SyndicationFeed f = new SyndicationFeed();            

            
            f.LastUpdatedTime = DateTimeOffset.Now;
            f.Title = SyndicationContent.CreatePlaintextContent("Currently running processes");
            f.Links.Add(SyndicationLink.CreateSelfLink(OperationContext.Current.IncomingMessageHeaders.To));

            f.Items = from p in processes
                      select new SyndicationItem()
                      {
                          LastUpdatedTime = DateTimeOffset.Now,
                          Title = SyndicationContent.CreatePlaintextContent(p.ProcessName),
                          Summary = SyndicationContent.CreateHtmlContent(String.Format("<b>{0}</b>", p.MainWindowTitle)),
                          Content = SyndicationContent.CreateXmlContent(new ProcessData(p))
                      };

            
            // Choose a formatter according to the query string passed.
            if (format == "rss")
            {
                return new Rss20FeedFormatter(f);
            }
            else
            {
                return new Atom10FeedFormatter(f);
            }
        }
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:33,代码来源:Program.cs


示例17: CreateFeed

        public SyndicationFeedFormatter CreateFeed()
        {
            // Create a new Syndication Feed.
            SyndicationFeed feed = new SyndicationFeed("Bug Track", "Flux rss du bug track", null);
            List<SyndicationItem> items = new List<SyndicationItem>();

            // Create a new Syndication Item.

            List<DBO.Bug> list = BusinessManagement.Bug.GetLastBug(10);

            foreach (DBO.Bug itemBug in list)
            {
                SyndicationItem item = new SyndicationItem(itemBug.ProjectName + " : " + itemBug.Title, itemBug.CreateDate + " \n " + itemBug.Details, null);
                items.Add(item);
            }

            feed.Items = items;

            // Return ATOM or RSS based on query string
            // rss -> http://localhost:8731/Design_Time_Addresses/SyndicationServiceBugTrack/Feed1/
            // atom -> http://localhost:8731/Design_Time_Addresses/SyndicationServiceBugTrack/Feed1/?format=atom
            string query = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["format"];
            SyndicationFeedFormatter formatter = null;
            if (query == "atom")
            {
                formatter = new Atom10FeedFormatter(feed);
            }
            else
            {
                formatter = new Rss20FeedFormatter(feed);
            }

            return formatter;
        }
开发者ID:yoan-durand,项目名称:TP,代码行数:34,代码来源:Feed1.cs


示例18: Normalize

        /// <summary>
        /// Normalizes a SyndicationItem into a FeedItem.
        /// </summary>
        /// <param name="feed">The <see cref="SyndicationFeed"/> on which the item was retrieved.</param>
        /// <param name="item">A <see cref="SyndicationItem"/> to normalize into a <see cref="FeedItem"/>.</param>
        /// <returns>Returns a normalized <see cref="FeedItem"/>.</returns>
        public virtual FeedItem Normalize(SyndicationFeed feed, SyndicationItem item)
        {
            var alternatelink = item.Links.FirstOrDefault(l => l.RelationshipType == null || l.RelationshipType.Equals("alternate", StringComparison.OrdinalIgnoreCase));

            Uri itemuri = null;
            Uri parsed;
            if (alternatelink == null && !Uri.TryCreate(item.Id, UriKind.Absolute, out parsed))
            {
                itemuri = parsed;
            }
            else
            {
                itemuri = alternatelink.GetAbsoluteUri();
            }

            return new FeedItem
            {
                Id = string.IsNullOrEmpty(item.Id) ? null : item.Id.Trim(),
                Title = item.Title == null ? null : Normalize(item.Title.Text),
                Content = item.Content == null ? null : Normalize(((TextSyndicationContent)item.Content).Text),
                Summary = item.Summary == null ? null : Normalize(item.Summary.Text),
                PublishDate = item.PublishDate,
                LastUpdatedDate = item.LastUpdatedTime == DateTimeOffset.MinValue ? item.PublishDate : item.LastUpdatedTime,
                Uri = itemuri
            };
        }
开发者ID:cmdrmcdonald,项目名称:EliteDangerousDataProvider,代码行数:32,代码来源:GalnetFeedItemNormalizer.cs


示例19: NewsRssFeed

        public ActionResult NewsRssFeed()
        {
            var latestNews = Umbraco.TypedContentAtXPath("//ulgNewsItem").Where(x => x.IsVisible()).OrderByDescending(x => x.GetPropertyValue<DateTime>("articleDate")).Take(20);

            var lastUpdate = (from news in latestNews
                              select news.UpdateDate).Max();
            SyndicationFeed feed =
                     new SyndicationFeed("Local Government Starter Kit News RSS Feed Example",
                                         "Latest News for Local Government Starter Kit site",
                                         new Uri("http://www.uLocalGov.co.uk"),
                                         "uLocalCovNews",
                                         lastUpdate);

            List<SyndicationItem> items = new List<SyndicationItem>();
            foreach (var newsItem in latestNews)
            {
                string itemTitle = string.Format("{0}", newsItem.GetPropertyValue("title"));
                   Uri itemURI = new Uri(newsItem.UrlWithDomain());
                string itemContent = string.Format("<p>{0:dddd, MM yyyy} - {1}</p>", newsItem.GetPropertyValue<DateTime>("articleDate"), newsItem.GetPropertyValue("newsSummary"));
                SyndicationItem item =
                    new SyndicationItem(itemTitle,
                                        itemContent,
                                        itemURI,
                                        newsItem.Id.ToString(),
                                        newsItem.UpdateDate);

                items.Add(item);
            }
            feed.Items = items;
            return new RssActionResult(feed);
        }
开发者ID:LiamMMcDermott,项目名称:uLocalGov,代码行数:31,代码来源:FeedsSurfaceController.cs


示例20: News

        public ActionResult News()
        {
            var items = _newsService.GetAllGeneric<NewsRssFeedViewModel>()
                .OrderByDescending(m => m.CreatedOn)
                .Take(30)
                .ToList()
                .Select(m => new SyndicationItem
                {
                    Title = new TextSyndicationContent(m.Title),
                    Summary = new TextSyndicationContent(m.Summary),
                    Content = new TextSyndicationContent(m.Description),
                    PublishDate = m.CreatedOn,
                    Id = m.Id.ToString(),
                    BaseUri = new Uri(Url.AbsoluteAction("Details", "News", new { id = m.Id })),
                })
                .ToList();

            var feed = new SyndicationFeed(CommonSettings.SiteDefaultTitle,
                CommonSettings.SiteDefaultDescription,
                null,
                Guid.NewGuid().ToString(),
                DateTime.Now);
            feed.Items = items;

            return new RssActionResult { Feed = feed };
        }
开发者ID:yasenm,项目名称:NewsSystem,代码行数:26,代码来源:RssController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Syndication.SyndicationItem类代码示例发布时间:2022-05-26
下一篇:
C# Syndication.Rss20FeedFormatter类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap