title: DDD solution structure
body: <p>I'm trying to create a nice a Solution structure for a new DDD project. I Created a "Core" project, where I added the Entities, ValueObjects and the repositories Interfaces then I added an "Infrastructure" project that contains the implementation of the previous IRepository.</p>
  
  <p>Now, since my db will be MongoDb I need to add the attributes like "[BsonDateTimeOptions]" in some of the fields of the Entities, this will require to add a reference to the MongoDb driver package in the core project.</p>
  
  <p>Since the core project should not contains any reference to MongoDb, should only contains business logic and it should be reusable in any other project (mobile - Xamarin) what should be the best practice in this situation?</p>
  
  <p>What I'm able to think is:</p>
  
  <ul>
  <li>the entities will not contains any reference to MongoDb</li>
  <li>create in the Infrastructure projects a model for each Entity, that is a copy of the related entity but with the MongoDb attributes.</li>
  <li>create a layer (in the repository?) that is able to use the model to query in the db, then transform it in entity and so returning the Entity, hiding inside the repository the model object.</li>
  </ul>
  
  <p>This approach has a problem, that I will have a copy of the entity, the model, which only has the MongoDb attributes, and when adding some fields to an entity, I will have to modify the model too. Is this the correct approach?</p>
  
  <p>Everything started from <a href="https://github.com/ardalis/CleanArchitecture" rel="nofollow noreferrer">this</a> solution structure.</p>