DotnetSparrow
DotnetSparrow

Reputation: 27996

getting all data from WCF Service

I am using following code to get all the pages of pages WCF Service:

 var ent = new DataSource(new Uri("http://api.abc.com/Service.svc"));

 ent.Credentials = new NetworkCredential("username", "pass");

DataServiceCollection<Rentals> rentals = new DataServiceCollection<Rentals>(ent.Rentals);
while (rentals.Continuation != null)
{
   rentals.Load(ent.Execute<Rentals>(rentals.Continuation));
}

foreach (var r in rentals)
{
   Response.Write(r.ListingID + "<br />");
}

but I am getting this error:

An attempt to track an entity or complex type failed because the entity or complex type 'NorthwindService.ServiceReference1.Rentals' does not implement the INotifyPropertyChanged interface.

Upvotes: 0

Views: 460

Answers (2)

Bill Mitchell
Bill Mitchell

Reputation: 66

I had the same symptom playing with a NorthwindClient WPF Application. The problem seems to be that, even after applying the later .NET 3.5 ADO.NET Data Services patch KB982306, the DataSvcUtil.exe still does not generate the INotifyPropertyChanged interface. The trick seems to be that you need the DataSvcUtil.exe (4.0.30319.17929) from the later .NET 4.0 version. After installing the .NET 4.0 pieces, you can following the instructions Arun Rana linked to execute DataSvcUtil manually, then copy the resulting .cs file into the appropriate ServiceReferences subdirectory, fixing up the namespace to match your earlier automatically generated version.

Upvotes: 3

Arun Rana
Arun Rana

Reputation: 8606

I think You might not enable code generation of binding interfaces. This is covered in step 2 of the walk-through as per this link http://blogs.msdn.com/b/astoriateam/archive/2009/09/01/introduction-to-data-binding-in-ctp2.aspx. Go try setting the environment variables as mentioned in step 2 and then right-click your service reference and select "Update Service Reference..."

Upvotes: 0

Related Questions