title: WCF DataContract Upcasting
body: <p>I'm trying to take a datacontract object that I received on the server, do some manipulation on it and then return an upcasted version of it however it doesn't seem to be working.  I can get it to work by using the KnownType or ServiceKnownType attributes, but I don't want to roundtrip all of the data.  Below is an example:</p>
  
  <pre><code>[DataContract]
  public class MyBaseObject
  {
      [DataMember]
      public int Id { get; set; }
  }
  
  [DataContract]
  public class MyDerivedObject : MyBaseObject
  {
      [DataMember]
      public string Name { get; set; }
  }
  
  
  [ServiceContract(Namespace = "http://My.Web.Service")]
  public interface IServiceProvider
  {
      [OperationContract]
      List&lt;MyBaseObject&gt; SaveMyObjects(List&lt;MyDerivedObject&gt; myDerivedObjects);
  }
  
  public class ServiceProvider : IServiceProvider
  {
      public List&lt;MyBaseObject&gt; SaveMyObjects(List&lt;MyDerivedObject&gt; myDerivedObjects)
      {
          ... do some work ...
  
          myDerivedObjects[0].Id = 123;
          myDerivedObjects[1].Id = 456;
          myDerivedObjects[2].Id = 789;
  
          ... do some work ...
  
          return myDerivedObjects.Cast&lt;MyBaseObject&gt;().ToList();
      }
  }
  </code></pre>
  
  <p>Anybody have any ideas how to get this to work without having to recreate new objects or using the KnownType attributes? </p>