title: WCF, Data-Updates & EntityReference object could not be serialized
body: <p>I did a lot of stuff with WCF where I first thought: "Hmm, this problem is weird" - but after I figured each one out, it always made somehow sense (sometimes more, sometimes less).<br />
  But now I'm at a point where I'm stuck and with all my imagination, I cannot think of a reason why this error appreas:</p>
  
  <blockquote>
    <p>The EntityReference object could not be serialized. This type of object cannot be serialized when the RelationshipManager belongs to an entity object that does not implement IEntityWithRelationships.</p>
  </blockquote>
  
  <p>To put it in a context, let me tell you about my program in a nutshell:<br />
  I have a client which send's an ID to my WCF.
  If this ID is in use, I'll grab it's related object from the EF (otherwiese I'll create a new one) and send it back.</p>
  
  <p>This all is done by Selftracking Entities - and getting the objects works fine, as well as the first update:</p>
  
  <pre><code>public static void UpdatePaperOnServer(ref PAPER p)
  {
      var newP = ServiceClient.UpdatePaper(p);
      p = newP;
  }
  </code></pre>
  
  <p>The reference "p" is a field in &lt; Program > and any changes will happen on this variable.<br /></p>
  
  <p>Here is the server-side implementation of UpdatePaper.<br />
  As you can see, no magic will happen here neither:</p>
  
  <pre><code>public PAPER UpdatePaper(PAPER p)
  {
      p.ChangePaperOnDb(); //Simple static DAL-Accessor, works fine
  
      return p; //The Client should get any changes made by other users so far, that's why I'll give the obj back... or if it's a new obj and it has an ID now
  }
  </code></pre>
  
  <p>As I said, my first Update works fine, but as soon as I trigger the update-routine again, I'll get this error which I mentioned above.</p>
  
  <p>After spending some time with my good mate google, I found only an approach where they changed the .NET-Version from 4.0 to 3.5.
  But I don't know if that would for me as I can't change the runtime from 4.0 to 3.5.</p>
  
  <p>If anyone has any clue what's going on - please let me know.
  Thank you very much!</p>