0
  1. I donot implement this interface in DC at Server.

  2. Though I got this implementation generated by VS2008 at client automatically, which is fine.

  3. Now i go and edit my Reference.cs to include a new field (differentiating the Server DC (inputparameter) of the particular service method)

  4. Compile, run the code pointing to old service, it works just fine though i set the value of new field (Example boolean type to true) ignoring my value.

  5. Then why should implement at server for the DC

  6. I am expecting forward compatibility and it is just working fine.

  7. Now i remove the code just i added in #3. Compile.

  8. Instead added the same field in server DC compile.

  9. Now i run the code sending lesser data from client to a server DC has more columns. It is just working fine. which means the backward compatibility is working fine?

  10. Hope some where my understanding is not correct?

My environment is .Net 3.5 Sp1

sahridhayan
  • 55
  • 1
  • 9

1 Answers1

1

IExtensibleDataObject is for different purpose. Suppose that you have operation like:

[DataContract]
public class MyObject
{
  [DataMember]
  public string MyMember { get; set; }
}

[ServiceContract]
public class MyService
{
  [OperationContract]
  public MyObject Operation(MyObject object)
  {
    object.MyMember += " modified";
    return object;
  }
}

Expected behavior is that Operation returns modified parameter.

Now suppose that you modify data contract on the client:

[DataContract]
public class MyObject
{
  [DataMember]
  public string MyMember { get; set; }
  [DataMember]
  public string MyNewMember { get; set; }
}

Now lets call the operation:

var client = new MyServiceClient();
var myObject = new MyObject
  {
    MyMember = "Member",
    MyNewMember = "Some value"
  }; 

MyObject returnedObject = client.Operation(myObject);

The service's data contract doesn't implement IExtensibleDataObject and it doesn't know about MyNewMember property. What value will be in returnedObject.MyNewMember? It will be null. But if you implement IExtensibleDataObject on the server side it will be "Some value" even the server doesn't know anything about this property.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
  • How that helps to achieve my forward and/or backward compatibility is my question? see http://bloggingabout.net/blogs/vagif/archive/2009/03/29/iextensibledataobject-is-not-only-for-backward-compatibility.aspx http://stackoverflow.com/questions/3434045 – sahridhayan Dec 28 '10 at 10:43
  • Based on my answer and on links you provided you should already understand when you need implement IExtensibleDataObject. If your service contract does not contain operation with data round tripping you don't need IExtensibleDataObject. – Ladislav Mrnka Dec 28 '10 at 11:26