Aplicación WP con WCF

I am making an WP7 app that connects to SQL DB through WCF. But after adding the client proxy and testing it, I got this error.

El tipo o nombre del espacio de nombres IExtensibleDataObject no existe en el espacio de nombres System.Runtime.Serialization (are you missing an assembly reference?)

preguntado el 08 de noviembre de 11 a las 17:11

2 Respuestas

Apparently (and according to este blog), the .NET Compact Framework used by WP7 does not expose IExtensibleDataObject en el objeto System.Runtime.Serialization espacio de nombres

Una alternativa es utilizar el Silverlight Service Model Proxy Generation Tool to generate the client proxy. The resulting code should work on WP7.

respondido 08 nov., 11:22

It might be worth verifying your need for implementing IExtensibleDataObject. That's designed for forward compatibility across data contracts of different versions, see Contratos de datos compatibles con versiones posteriores.

If you're (1) not working on a scenario that requires round-tripping data (e.g., sending a message to a service and having it send a message back with the same data contract in it) and (2) don't need to support a client using the new data contract sending a message to a service that only understands the previous version of the data contract, which then returns a message using the data sent in, back to the new version of the client. While that can be an important scenario, it's not what everyone needs to support. Often backward compatibility is sufficient. And the IExtensibleDataObject approach does assume that the extra data that's in the new data contract can be ignored by the logic of the old service, and just returned intact to the caller. Again, that applies to some cases and not others. In the simplest case, what would cause you to have to support a new version of the phone application round-tripping data to an older version of the service?

If you don't think you need that capability, then it might be worth considering removing the IExtensibleDataObject contract from your service.

If you do need that style of forward compatibility, then another option would be to work without WCF-generated proxies, create the channel and send and receive System.ServiceModel.Channels.Messages and process the SOAP message yourself, including deciding what you want to do with extra XML elements that weren't part of the original contract. Definitely an advanced topic, but it can be done if you set your mind to it.

respondido 09 nov., 11:04

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.