Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 7th, 2012  |  syntax: None  |  size: 0.40 KB  |  hits: 5  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. What's the best way to turn an EF proxy object into the original POCO object?
  2. // GET api/Clients/5
  3.     public Client GetClient(int id)
  4.     {
  5.         Client client = db.Clients.Find(id);
  6.         if (client == null)
  7.         {
  8.             throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
  9.         }
  10.  
  11.         return client;
  12.     }
  13.        
  14. db.Configuration.ProxyCreationEnabled = false;