Ulrich Fischer
Ulrich Fischer

Reputation: 173

Object references lost after service call

is there a simple way to keep the references from one object to another after a WCF-Service call? Here is a little sample:

Class1 obj1 = new Class1();
obj1.Tag = "foo";

Class2 obj2 = new Class2();
obj2.Class1 = ob1;

So when I change the Tag-property of obj1 to "bar" obj2.obj1.Tag will, obviously, also result in "foo". But this behaviour gets lost when I pass the second object to a WCF-Service and try to do the same operation there. Is there a possibility to achieve that?

Upvotes: 0

Views: 104

Answers (1)

Eugene Osovetsky
Eugene Osovetsky

Reputation: 6541

You need to use [DataContract(IsReference=true)] on your types. See MSDN for details.

Upvotes: 2

Related Questions