views:

115

answers:

1

Let's say I have an web 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"&gt;
  <title type="text">Articles</title>
  <id>http://localhost/projectname/DataService.svc/Articles&lt;/id&gt;
  <updated>2010-05-21T09:41:22Z</updated>
  <link rel="self" title="Articles" href="Articles" />
  <entry>
    <id>http://---------DataService.svc/Articles(1)&lt;/id&gt;
    <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&lt;/d:Source&gt;
      </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)?

A: 

Its possible to do using WCF data services.

Here' the link which tells us you what is possible using the Friendly feeds feature: http://blogs.msdn.com/b/phaniraj/archive/2009/03/18/introducing-web-friendly-feeds-aka-friendly-feeds.aspx

Here's the link which tells you how to go about doing this: http://blogs.msdn.com/b/phaniraj/archive/2009/03/28/ado-net-data-services-friendly-feeds-mapping-edm-types-i.aspx

Thanks Pratik

Pratik Patel
awesome, exactly what I was looking for!
Stephan