title: C# WCF REST Service interprets received type as base class
body: <p>I have a C# WCF REST service running, which works fine and dandy. However, at some point, I'm executing a PUT request to update a class. The (trimmed) JSON that I send to the WCF service:</p>
  
  <pre><code>{
      "admin": {
          "EntityName": "TestAdmin_xCCg_edited",
          "EntityParent": {
              "TenantBankAccountNr": "1234567",
              "TenantCity": "Amsterdam",
              "TenantCountry": "Holland",
              "TenantGroup": null,
              "TenantNr": "1P",
              "TenantPrefix": "MB",
              "TenantStreet": "DeStraatStraat",
              "TenantStreetNr": "38",
              "TenantVatNr": "1234",
              "TenantZipcode": "1442",
              "AdSynced": false,
              "CreatedByUser": null,
              "CreationDate": "0001-01-01T00:00:00+01:00",
              "EntityName": "Partner_NXfL",
              "EntityParent": {
                  "AdSynced": false,
                  "CreatedByUser": "Unknown",
                  "CreationDate": "2013-02-13T15:59:28+01:00",
                  "EntityName": "Veliq",
                  "EntityParent": null,
                  "EntityType": 2,
                  "EntityUID": "172de253-b71d-44ef-ae52-94c21ca957ba",
                  "GroupMemberships": null,
                  "LazyProperties": [
                      "EntityParent",
                      "GroupMemberships"
                  ],
                  "MappedIdentifier": null,
                  "MappedSystem": null,
                  "ModificationDate": "2013-02-13T15:59:28+01:00",
                  "ModifiedByUser": "Unknown"
              },
              "EntityType": 2,
              "EntityUID": "2a15f1ea-fefb-408f-9c88-abcb392ad9c3",
              "GroupMemberships": null,
              "LazyProperties": [
                  "EntityParent",
                  "GroupMemberships",
                  "TenantGroup"
              ],
              "MappedIdentifier": null,
              "MappedSystem": null,
              "ModificationDate": "0001-01-01T00:00:00+01:00",
              "ModifiedByUser": null
          },
          "EntityType": 6,
          "EntityUID": "70bc26fc-f50d-4e11-8b04-983b1c5978c0",
      }
  }
  </code></pre>
  
  <p>The base object ("admin" object, of type WSAdmin) gets sent over fine, but the problem is that the EntityParent field is not. It is of WSPartner type (which extends WSTenant which extends WSEntity), but the data received by the server is of WSEntity type. That means it truncates a lot of data it really shouldn't. How could I resolve this issue? Manually adding the "__type" : "WSPartner:#MOBIWS" flag didn't work, it throws the exception about ServiceKnownType etc. I've added all those types already and they work.</p>
  
  <p>I've also seen an issue about <a href="https://stackoverflow.com/questions/8625803/preserving-polymorphic-types-in-a-wcf-service-using-json" title="whitespace giving errors">whitespace giving errors</a>, but that wasn't the issue for me (I was sending non-prettified JSON). Any help would be much appreciated!</p>