title: Best practices for not passing object references on service calls
body: <p>I have an application where a client communicates with a server side through REST. This is written in .Net, but I guess the question should be independent of this. </p>
  
  <p>Now - I have services such as <code>GetAllCustomers</code> and <code>GetCustomerById</code>. A Customer has references to a potentially big list of Order, so I don't want to pass the Customers references from the <code>GetAllCustomers</code> service. I basically want to return the Customers with their simple data, but no references. Then I will do another service call <code>GetCustomerById</code> to fetch the complete data when a Customer is selected in the client. </p>
  
  <p>The question now is - is there a recommended way of handling this? Using Lazy Loading I can simply pass the object before the references are loaded - and then make sure this isn't used on the client side. But is this ugly? (Also - I got problems communicating lazy loaded objects with REST, but it worked with SOAP - but this is a different question..) I guess I could fetch all data from the database and then delete the references before I return it, but this sure sounds hacky. Also I still get unnecessary load on my database.. </p>
  
  <p>So; is there a good solution to this? </p>