Last week I showed how to use the Telerik OpenAccess WCF Wizard to automatically create a feed in Atom Syndication Format using the WCF REST Starter Kit’s Visual Studio project templates. Based on the feedback we have gotten from the community on the ATOMPub projects, Telerik has refreshed the WCF Wizard (go download it now) to enhance the ATOMPub projects.
Let’s take a step back first. The Atom Syndication Format is for feeds, similar to RSS. So when you run the project that we looked at in my blog last week in default IE 8 (or IE 7) feed view, it would look something like this. This is no different from what my feeds look like from CNN and ESPN, etc.
But how did IE decide what to put as the title or the description of each item in the feed? (And since we are just exposing OpenAccess entities as feeds, the real question is which properties (or database fields at the end of the day) did IE choose for you?)
If you go back to IE settings and turn off feed view (which I always recommend when working with Astoria, REST Collection, and ATOMPub services) you can view the raw XML.
As shown in raw XML ATOM feed below in lines 3 and 4 you can see that the Company Name and Contact name were randomly placed into those fields (and that is how IE uses that data to display.) Well it was not randomly selected, I just hard coded those two fields in my demo. For applications these two fields are usually ignored. But it would be nice to have them set to something useful.
3: <title type="text">Alfreds Futterkiste</title>
4: <summary type="text">Maria Anders</summary>
7: <category term="customers" />
8: - <content type="text/xml">
10: <Address>Obere Str. 57</Address>
12: <CompanyName>Alfreds Futterkiste</CompanyName>
13: <ContactName>Maria Anders</ContactName>
14: <ContactTitle>Sales Representative</ContactTitle>
20: <Region i:nil="true" />
The latest version of the WCF Wizard will now give you a dialog, so you don’t have to alter the code at all. As you can see from the screen shot below, the wizard now gives us a drop down so we can choose which property to expose in feed view as the title and description. So just to be different, I will choose the company name as the title and the Address as the description.
When we look at the raw ATOMPub XML you will see Company Name and Address in lines 3 and 4.
4: <summary type="text">Obere Str. 57</summary>
If you view the service in feed view in IE, you will now see the Company Name and Address as the title and description.
Of course this did not effect our Silverlight front end since the application just ignored those fields. Those fields are available to the application, but we did not use them (we only used two fields (company name and contact name from the main XML tree.)
Page rendered at Monday, September 21, 2020 8:16:37 PM (Eastern Daylight Time, UTC-04:00)
The opinions expressed herein are my own personal opinions and do not represent
my employer's view in anyway.