title: WCF: Returning a derived object for a contract with base object (DataContractResolver)
body: <p>I have have a WCF derived/base contract issue. I have a server interface/contract that returns a <code>BaseThing</code> object:</p>
  
  <pre><code>[OperationContract]
  BaseThing Get_base_thing();
  </code></pre>
  
  <p>The server that implements this has a <code>DerivedThing</code> (derived from <code>BaseThing</code>) and wants to return this as a <code>BaseThing</code>. <strong>How to tell WCF that I only want to transport the <code>BaseThing</code> part of <code>DerivedThing</code>?</strong>  </p>
  
  <p>If in <code>Get_base_thing</code> I just return a reference to a <code>DerivedThing</code> then I get a <code>SerializationException</code> server side.  </p>
  
  <p>I think I need to define a <code>DataContractResolver</code> and I looked at the MSDN article <a href="http://msdn.microsoft.com/en-us/library/ee358759.aspx" rel="nofollow">Using a Data Contract Resolver</a> but this is not 100% clear (to me a least).  </p>
  
  <p>How should my <code>DataContractResolver</code> look to tell WCF to only transport the base part of the derived object I pass it?</p>
  
  <p>Is there some way to do this more simply just with <code>KnownType</code> attribue?</p>