Question

I am working on a Silverlight applicaiton. It uses WCF services to pass EF 4 Self Tracking Entities back and forth from client to server.
Read methods are working fine to serve the Trackable entity collections to the Silverlight client from the WCF services. Even basic updates are working correctly. I can modify a property of "OfficeEntity", and pass it as a parameter to a WCF update method. The issue we are having is when we update one of the Entity's collections, we get the below deserialization error. For example, if "OfficeEntity" has a navigation property "Locations" that is a collection of "LocationEntity", and we add a new "Location" to the "Locations" property and save it, we get the deserialization exception.

officeEntity.Locations.Add(new Location() {LocationName = "Test 1"});

client.SaveAsync(officeEntity);

Exception Details:

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter :OfficeEntity. The InnerException >message was 'There was an error deserializing the object of type Entities.OfficeEntity. End element 'ObjectsAddedToCollectionProperties' from namespace >'http://schemas.datacontract.org/2004/07/Entities' expected. Found element 'b:AddedObjectsForProperty' from namespace >'http://schemas.datacontract.org/2004/07/Entities'.'

It appears the problem is with deserializing the change tracking properties. Any ideas on what causes this or where I can fix it?

Thanks, Jason

Was it helpful?

Solution

Self tracking entities have issues with tracking if the actual generated entities aren't used in the client - I blogged about it here.

Not sure if this is at the root of your serialization issues but will definitely have an impact on you being able to use self-tracking entities

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top