title: How to update a related CRM entity reference with ODataLib?
body: <p>I'm using the ODataLib (<a href="http://odata.github.io" rel="nofollow noreferrer">http://odata.github.io</a>) and the Client Generated Library to access Microsoft CRM's OData API (v9.0).</p>
  
  <p>I'm trying to update the entity navigation property value (the GUID), but the update doesn't seem to do anything (no calls are made).</p>
  
  <p>If I try to update the navigation property's value directly, I get an error saying that "CRM do not support direct update of Entity Reference properties, Use Navigation properties instead".</p>
  
  <p>The entity is basically the middle entity in N:N relationship.</p>
  
  <p>Basically what I'm doing in code is (semi pseudo-code):</p>
  
  <pre><code>Account a = _dao.GetAccount();
  
  // This gets the dataservicecollection that tracks the changes
  DataServiceCollection&lt;MyRelationEntity&gt; rel = _dao.GetMyRelationEntity();
  
  rel.AccountId = a;
  
  _dao.SaveChanges(SaveChangesOptions.PostOnlySetProperties);
  </code></pre>
  
  <p>Should I be using the AddLink, UpdateLink or something similar? They don't seem to do anything also.</p>
  
  <p>I apologize if the terminology is not correct; I'm quite new to CRM.</p>