title: DDD Aggregates: Entity holding identifier to Non-Root Entity in another Aggregate
body: <p>I'm trying to understand Best Practise for relationships between entities and aggregates.</p>
  
  <p>Imagine a design where you have a <strong>Product Aggregate</strong>, made up of of two entities:</p>
  
  <p><strong>Aggregate Root: Product</strong></p>
  
  <p><strong>Child Entity: Sku</strong></p>
  
  <p>Where a product can have many Skus. The part numbers and names of the Skus and Product are invariant, in that changing the name of one must transactionally ensure the other is updated. Likewise, the product aggregate needs to ensure there are never duplicate Skus.</p>
  
  <p>We have another <strong>Aggregate: StorageLocation</strong>. where 1 or more Skus are stored. However it's important that the StorageLocation know the specific Sku it's storing. ie. A StorageLocation in Canada should store the Sku local to that country, and not a Sku intended for the US market.</p>
  
  <p>This implies to me that the StorageLocation needs to keep a reference to the Sku (as a reference to the Product Aggregate Root by itself does not provide enough information to determine the Sku being Stored).</p>
  
  <p>From my readings this seems to break the principle that another Aggregate should not hold a reference to a non-root entity in another Aggregate. So question:</p>
  
  <ul>
  <li>Is holding just an identifier to the Product and Sku in the StorageLocation aggregate acceptable? </li>
  <li>I'm aware that a transient reference is deemed allowable, but in this instance (at least as far as I can tell) this information needs to be stored. As mentioned, storing a reference to the Product (or ProductId) is not enough.</li>
  <li>Product and Skus have natural identifiers (Part Number, Sku Number). Does this provide greater flexibility for storing these values in the StorageLocation aggregate as they have meaning beyond technical implications.</li>
  <li>Am I approaching this the wrong way and need to look at things differently. I often find it difficult to break out of a PK / FK mindset.</li>
  </ul>
  
  <p>Thanks</p>