Pergunta

I tried to use WcfInstantFeedbackDataSource from DevExpress 13.2.9 (located in Xpf.Core.Extensions) with a data service (its source is a MongoDB).

I intend to use it with an ASP.Net page so I used the following code:

 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();

I have WCF Data Services 5.6 installed.

My data source is a valid AtomXML feed:

  <?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>

On the Query call, I get this exception:

'http://xxxxx.azurewebsites.net/MongoDataService.svc/test' is not a valid value for property 'Query'.

What should I change?

EDIT:

If I add this line:

DataServiceContext = ctx

here:

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

I get this error:

'MongoDataServiceRef.MongoContext' is not a valid value for property 'DataServiceContext'.

It is strange as MongoContext is a descendant of DataServiceContext:

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

Any idea?

Foi útil?

Solução

WcfInstantFeedbackDataSource cannot be used with an ASPxGridView, I had to use a WcfServerModeSource.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top