title: Is there a design pattern for light & heavy versions of an object?
body: <p>I have the need for both light-weight, and heavy-weight versions of an object in my application.  </p>
  
  <ul>
  <li>A light-weight object would contain only ID fields, but no instances of related classes.   </li>
  <li>A heavy-weight object would contain IDs, and instances of those classes.</li>
  </ul>
  
  <p>Here is an example class (for purpose of discussion only): </p>
  
  <pre><code>public class OrderItem
  {
      // FK to Order table
      public int OrderID;
      public Order Order;
  
      // FK to Prodcut table
      public int ProductID;
      public Product Product;
  
      // columns in OrderItem table
      public int Quantity;
      public decimal UnitCost;
  
      // Loads an instance of the object without linking to objects it relates to.
      // Order, Product will be NULL.
      public static OrderItem LoadOrderItemLite()
      {
          var reader = // get from DB Query
          var item = new OrderItem();
          item.OrderID = reader.GetInt("OrderID");
          item.ProductID = reader.GetInt("ProductID");
          item.Quantity = reader.GetInt("Quantity");
          item.UnitCost = reader.GetDecimal("UnitCost");
          return item;
      }
  
      // Loads an instance of the objecting and links to all other objects.
      // Order, Product objects will exist.
      public static OrderItem LoadOrderItemFULL()
      {
          var item = LoadOrderItemLite();
          item.Order = Order.LoadFULL(item.OrderID);
          item.Product = Product.LoadFULL(item.ProductID);
          return item;
      }
  }
  </code></pre>
  
  <p><strong>Is there a good design pattern to follow to accomplish this?</strong>  </p>
  
  <p>I can see how it can be coded into a single class (as my example above), but it is not apparent in which way an instance is being used.  I would need to have NULL checks throughout my code.</p>
  
  <p><strong>Edit:</strong>
  This object model is being used on client side of client-server application.  In the case where I'm using the light-weight objects, I don't want lazy load because it will be a waste of time and memory ( I will already have the objects in memory on client side elsewhere)</p>