title: How to make WCF Dataservice to stop tracking Entity changes?
body: <p>I have web app which invokes OData Webservice (<code>DataServiceContext</code>) via a proxy. The issue is the code even though makes a call to OData webservice every time, it always returns old data after changing content in the Content Management system (SDL Tridion). </p>
  
   
  
  <pre class="lang-cs prettyprint-override"><code>string getPageContentForUrl(string url)
  {
      var page = cdService
                     .Pages
                     .Expand("PageContent")
                     .Where(x =&gt; x.Url == url)
                     .FirstOrDefault();
  
      if (page == null || page.PageContent == null)
      {
          return string.Empty;
      }
      else
      {
          return page.PageContent.Content;
      }
  
  }
  </code></pre>
  
  <p>We had to an reset the apppool to see the latest data changes.</p>
  
  <p>So while debugging more, I noticed that </p>
  
  <pre class="lang-cs prettyprint-override"><code>var context = (System.Data.Services.Client.DataServiceContext)cdService;
  context.Entities[0].State = Unchanged
  </code></pre>
  
  <p>so I tried fixing it by calling <code>.Detach()</code> explicitly before returning the value from <code>getPageContentForUrl</code>, so something like, </p>
  
  <pre class="lang-cs prettyprint-override"><code>cdService.Detach(page);
  cdService.Detach(page.PageContent);
  </code></pre>
  
  <p>My question is, can I do the above at more "global" level, maybe have webservice always assume the State as "Changed", since I don't want to manually write code to <code>Detach()</code>?</p>