title: How to deal with value objects in Entity Framework?
body: <p>How do I persist value objects in Entity Framework without polluting my domain model? EF (well, relational DBs in general) require me to define a key - which my value objects don't have out of the box, for example</p>
  
  <pre><code>public class Tag : ValueObject&lt;Tag&gt;
  {
     private readonly string name;
  
     public Tag(string name)
     {
        this.name = name;
     }
  
     public string Name { get { return this.name; }}
  }
  </code></pre>
  
  <p>On the other hand, I shouldn't address persistence concerns in the model. Am I really supposed to create another class that includes all the fields from the value object plus a key property and then map them to each other? I'd rather not.</p>
  
  <p>Is there maybe a more elegant solution?</p>