使用.Net Dataservices / OData / Atom的新闻源?

时间:2010-05-21 10:21:28

标签: .net wcf-data-services odata

假设我有一个Web CMS类型的应用程序,以及一个名为“article”的实体的EDM模型,我需要提供

  1. 客户端应用程序,读取/查询文章(以及存储在我们数据库中的其他资源)的能力
  2. 向最终用户提供这些文章的直接联合供稿(沿着简单的RSS供稿行)
  3. 在我看来,对于第一项任务而言,.net 4的数据服务将非常适合这项工作。对于第二种情况,我想知道(a)atom是否选择正确的格式 - 我认为是 - 以及(b)是否可以使用相同的ado.net OData服务来实现这样的Feed。

    我看了一些例子并简要地设置了一个概念证明:

    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>
    

    并注意到,虽然Feed正常并且项目显示,但是条目级别的标题标记留空。 (因此,当您在Feed阅读器中检查此Feed时,您将看不到标题)。我搜索了msdn,但没有找到办法做到这一点,但它应该是可能的。 Stackoverflow本身以这种方式使用原子进给,因此它应该是可能的。正确?

    所以我想我的问题是;有没有办法让ado.net dataservice Atom feed看起来像适合普通新闻提要阅读器的东西? - 或者,我是否使用错误的工具用于错误的目的,我应该在其他地方寻找(也许是.net syndication API)?

1 个答案:

答案 0 :(得分:0)

可以使用WCF数据服务。

此处的链接告诉我们您使用友情Feed功能的可能性:http://blogs.msdn.com/b/phaniraj/archive/2009/03/18/introducing-web-friendly-feeds-aka-friendly-feeds.aspx

以下链接告诉您如何执行此操作:http://blogs.msdn.com/b/phaniraj/archive/2009/03/28/ado-net-data-services-friendly-feeds-mapping-edm-types-i.aspx

由于 PRATIK

相关问题