title: Entity Framework 4: Selecting Single Record
body: <p>I'm currently planning on switching my "manual query-writing" code to a nice SQL framework, so I can leave the queries or sql things to the framework, instead of writing the queries myself.</p>
  
  <p>Now I'm wondering how I can get a single record from my table in Entity Framework 4?</p>
  
  <p>I've primarily used SQL like <code>SELECT * FROM {0} WHERE Id = {1}</code>. That doesn't work in EF4, as far as I'm concerned.</p>
  
  <p>Is there a way I can select a single ID-Based record from my Context?</p>
  
  <p>Something like:</p>
  
  <pre><code>public Address GetAddress(int addressId)
  {
      var result = from Context.Addresses where Address.Id = addressId;
  
      Address adr = result as Address;
  
      return Address;
  }
  </code></pre>
  
  <p>Thank you!</p>