开发者

news feed using .Net Dataservices / OData / Atom?

Let's say I have an we开发者_Go百科b CMS type application, and an EDM model with an entity called 'article', and I need to offer

  1. the ability for client applications, to a read/query the articles (and other resources stored in our database)
  2. a straightforward syndication feed of these articles to end users (along the lines of a simple RSS feed)

It seems to me that for the first task, and .net 4's dataservice would be perfect for the job. For the second case, I'm wondering (a) whether atom the right format to choose - I think it is - and (b) whether it's possible to achieve such a feed using the same ado.net OData service.

I took a look at some of the examples out there and briefly set up a proof of concept:

http://localhost/projectname/DataService.svc/Articles

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="http://localhost/projectname/DataService.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
  <title type="text">Articles</title>
  <id>http://localhost/projectname/DataService.svc/Articles</id>
  <updated>2010-05-21T09:41:22Z</updated>
  <link rel="self" title="Articles" href="Articles" />
  <entry>
    <id>http://---------DataService.svc/Articles(1)</id>
    <title type="text"></title>
    <updated>2010-05-21T09:41:22Z</updated>
    <author>
      <name />
    </author>
    <link rel="edit" title="Article" href="Articles(1)" />
    <category term="Model1.Article" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <content type="application/xml">
      <m:properties>
        <d:int_ContentID m:type="Edm.Int32">1</d:int_ContentID>
        <d:Titel>hello world</d:Titel>
        <d:Source>http://www.google.com</d:Source>
      </m:properties>
    </content>
  </entry>
</feed>

and noticed that, though the feed works and items are showing up, the title tag on the entry level is left blank. (as a result, when you check this feed in a feed reader, you will see no title). I searched msdn but haven't found a way to do that, but it should be possible. Stackoverflow itself uses an atom feed in that fashion, so it should be possible. Right?

So I suppose my question is; Is there a way to make the ado.net dataservice Atom feed look like something suitable for your average news feed reader? - OR, am I using the wrong tool for the wrong purposes, and should I be looking elsewhere (.net syndication API's perhaps)?


Its possible to do using WCF data services.

Here' the link which tells us you what is possible using the Friendly feeds feature: Link

Here's the link which tells you how to go about doing this: Link

Thanks Pratik

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜