title: DDD: Model local identity inside agregate root
body: <p>after reading the blue book (Eric Evan's Domain Driven Design) and starting applying the DDD concepts in a simple blog like application I have the following question, how do you model a local identity of an entity inside an aggregate root??</p>
  
  <p>Let's say for the sake of simplicity, I have a simple blog model that has the following entities and scenarios:
  A registered user can publish a post, a post can have one or more tags associated and a registered or unregistered user can publish a comment on a post.</p>
  
  <p>In this scenario, the entities are User, Post, and Comment, the aggregate roots are User na Post being comment an aggregate inside Post aggregate root.</p>
  
  <p>So since the comment entity has a local identity inside Post how do I model its local identity?? I.E. I cannot differenciate a comment just by it's attributes since I can have twho different comments for the same post published by the same user with the same content...</p>
  
  <p>I first thought of the order of the comment inside the post's comment list to identify the comment inside the post, but this becomes very complex in concurrent environments, like a web application where two clients can post comments on blogs and I would have collisions until I store them in the database. Besides that I need to keep the logic for restoring the comment list from repository in the same order the post was saved to the repository...</p>
  
  <p>Then having a unique identifier counter inside the Post and autoincrement it with every comment published, but in concurrent environment becomes complex, so how do I model the local identity inside an aggregate root??</p>
  
  <p>Thanks
  Pablo</p>