title: WCF REST service won't return children of Entities
body: <p>I have written a WCF service with the REST template that has the defaultOutgoingResponseFormat set to Json.  Under that, I have built a simple entity model using Entity Framework and ObjectContext, in order to pass around custom POCO entities.</p>
  
  <p>If I pass a single entity, the system works as expected. If I add children to the entity, the REST response is blank. In the debugger, the entity is populated correctly, but the service itself returns nothing at all.</p>
  
  <p>So, for instance, I have a Trip.Get() method. The WCF code looks like this:</p>
  
  <pre><code>[WebGet(UriTemplate = "{id}", ResponseFormat = WebMessageFormat.Json)]
  public Model.Trip Get(string id)
  {
      Model.Trip fetchedTrip = null;
      try
      {
          fetchedTrip = Library.Trip.Get(new Guid(id));
      }
      catch (Exception ex)
      {
          Debug.Write(ex.Message);
      }
      return fetchedTrip;
  }
  </code></pre>
  
  <p>Library.Trip.Get looks like this in the working version:</p>
  
  <pre><code>public static Model.Trip Get(Guid tripId)
  {
      using (Model.POCOTripContext context = new Model.POCOTripContext())
      {
          var tripEntity = context.Trips.FirstOrDefault(c =&gt; c.Id == tripId) ?? new Model.Trip();
          return tripEntity;
      }
  }
  </code></pre>
  
  <p>This returns the expected result, which looks like this:</p>
  
  <p>{"ArrivalDate":"/Date(1334203200000-0400)/","DepartureDate":"/Date(1334721600000-0400)/","Id":"d6413d96-fe1f-4b1c-ae7a-3bbf516cdc2f","Name":"Test 123","Photos":null,"PlacesOfInterest":null,"WhereTo":"Orlando, FL"}</p>
  
  <p>If I change the Library method to add in the children, however, the REST service returns a blank value. Nothing, nada.</p>
  
  <pre><code>public static Model.Trip Get(Guid tripId)
  {
      using (Model.POCOTripContext context = new Model.POCOTripContext())
      {
          var tripEntity = context.Trips.Include("PlacesOfInterest").Include("Photos").Include("PlacesOfInterest.PoiAttributes").FirstOrDefault(c =&gt; c.Id == tripId) ?? new Model.Trip();
          return tripEntity;
      }
  }
  </code></pre>
  
  <p>The debugger, in the WCF service on the return statement, shows that the entity is fully and correctly populated.</p>
  
  <p>I am certain that I am just missing some magic attribute, and am hoping that someone who has dome this before might be able to help me out!</p>