title: How to update an existing object's properties using LINQ to Entities?
body: <p>LINQ to Entities allows this:</p>
  
  <pre><code>context.User.Select(u =&gt; new Person
  {
      Name = u.Name,
      Parent = u.Parent.Name
  });
  </code></pre>
  
  <p>I need only two properties of a big <code>User</code> table and I get them using the <code>Select</code> method to create a <code>Person</code> object so I can do some processing with it. The thing is that I do this a lot (like twice a second) and it hurts the <code>GC</code>.</p>
  
  <p>So I decided to pool the <code>Person</code> objects but I have no idea how to update an existing object using LINQ to Entities. I can get it as an anonymous method like above and then assign its properties to the depooled object I guess, then I can return the depooled instance, this would at least make the anonymous instance go away in a lower generation of <code>GC</code> but...</p>
  
  <p>I'd really prefer something like this:</p>
  
  <pre><code>context.User.Select(u =&gt; People.Take(u.Name, u.Parent.Name))
  </code></pre>
  
  <p>Which throws a <code>NotSupportedException</code>.</p>
  
  <ul>
  <li>Can I use Entity Framework to update the values of an existing object?</li>
  <li>If so, how?</li>
  <li>If not, what alternatives do I have?</li>
  </ul>