【问题标题】:WcfInstantFeedbackDataSource cannot read valid Data Service sourceWcfInstantFeedbackDataSource 无法读取有效的数据服务源
【发布时间】:2014-04-24 10:37:33
【问题描述】:

我尝试将 DevExpress 13.2.9(位于 Xpf.Core.Extensions)中的 WcfInstantFeedbackDataSource 与数据服务(其源是 MongoDB)一起使用。

我打算将它与 ASP.Net 页面一起使用,所以我使用了以下代码:

 ctx = new MongoContext(new Uri("http://xxxxx.azurewebsites.net/MongoDataService.svc/"));
      Thread t = new Thread(() =>
      {
        Datas = new WcfInstantFeedbackDataSource()
          {
            KeyExpression = "_id",
            Query = (DataServiceQuery)ctx.test
          };
      });
      t.SetApartmentState(ApartmentState.STA);
      t.Start();

我已安装 WCF 数据服务 5.6。

我的数据源是一个有效的 AtomXML 提要:

  <?xml version="1.0" encoding="utf-8" ?> 
<feed xml:base="http://xxxxx.azurewebsites.net/MongoDataService.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
  <id>http://xxxxx.azurewebsites.net/MongoDataService.svc/test</id> 
  <title type="text">test</title> 
  <updated>2014-04-24T09:20:11Z</updated> 
  <link  rel="self" title="test" href="test" /> 
  <entry>
  <id>http://xxxxx.azurewebsites.net/MongoDataService.svc/test('5347cc29fe4c65b466e604f9')</id> 
  <category  term="Mongo.test" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
  <link  rel="edit" title="test" href="test('5347cc29fe4c65b466e604f9')" /> 
  <title  /> 
  <updated>2014-04-24T09:20:11Z</updated> 
 <author>
  <name  /> 
  </author>
<content type="application/xml">
<m:properties>
  <d:db_id>5347cc29fe4c65b466e604f9</d:db_id> 
  <d:adat>1234</d:adat> 
  </m:properties>
  </content>
  </entry>
  </feed>

在查询调用中,我得到了这个异常:

'http://xxxxx.azurewebsites.net/MongoDataService.svc/test' 不是 属性“查询”的有效值。

我应该改变什么?

编辑

如果我添加这一行:

DataServiceContext = ctx

这里:

 Thread t = new Thread(() =>
          {
            Datas = new WcfInstantFeedbackDataSource()
              {
                DataServiceContext = ctx,
                KeyExpression = "_id",
                Query = (DataServiceQuery)ctx.test
              };
          });
          t.SetApartmentState(ApartmentState.STA);
          t.Start();

我收到此错误:

'MongoDataServiceRef.MongoContext' 不是属性的有效值 'DataServiceContext'。

奇怪的是,MongoContext 是 DataServiceContext 的后代:

  public partial class MongoContext : global::System.Data.Services.Client.DataServiceContext

有什么想法吗?

【问题讨论】:

    标签: asp.net mongodb devexpress wcf-data-services


    【解决方案1】:

    WcfInstantFeedbackDataSource 不能与 ASPxGridView 一起使用,我必须使用 WcfServerModeSource

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-05
      相关资源
      最近更新 更多