Is it possible to share Objects between applications without serialization?
Is it possible to share Objects between C# applications without serialization?
I need three apps to share an instance of the same object, but the object itself doesn't support serialization.
The scope is: I'm developing some apps to create some kind of interoperability between SVN and TFS repositories. But I don't want to connect to tfs server on the three apps (useless time consuming) since one of them is just a set of small utilities, and I don't want it to have a slow loading.
So I was thinking of using RemotingServices.Marshal, registering the connection object temporarily in a tcp channel, and calling the object开发者_运维问答 whenever I need it in the other apps.
But here's the thing. Many objects in TeamFoundation.Client aren't serializable, so I get an error when trying to retrieve the object.
How can I solve this ?
The direct alternative to serialization is remoting, but that also requires changes to the types, so isn't going to work.
Rather than trying to serialize the TFS objects, I would write a object model that resembles the TFS objects (or better: the requests etc that you want to perform), and send that. Then reconstruct as needed. Essentially a shallow DTO layer on top of the actual objects.
Obviously you'll need to reconstruct the TFS model as needed (based on the DTO state), but that is life.
精彩评论