title: Dapper working with Value Objects to perform all DB operations
body: <p>I'm working on a large project (.net core 3.1) where it uses Dapper to perform all the DB operations (create, read, update, delete).
  I was trying to implement <a href="https://martinfowler.com/bliki/ValueObject.html" rel="nofollow noreferrer">Value Objects</a> on my domain where each class represents the tables in the DB.</p>
  <p>Example:</p>
  <pre><code>//Value object:
  public class Address {
      public string Town { get; set; }
      public string Street { get; set; }
      public string Region { get; set; }
      ...
  }
  
  [Table(&quot;Contact&quot;)] //Dapper attribute
  public class Contact {
      public Int32 Id { get; set; }
      public string Name { get; set; }
      public Address Address { get; set; }
  }
  </code></pre>
  <p>Is there any way, out of the box, to Create/Update/Read these classes to the DB with Dapper?</p>
  <p>The only way I found is to create &quot;manually&quot; the command, constructing the query and the object from scratch and then call the Execute method from the Dapper class SqlMapper (
  <code>public static int Execute(this IDbConnection cnn, string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)</code>)</p>
  <p>I found this <a href="https://stackoverflow.com/questions/7472088/correct-use-of-multimapping-in-dapper">Correct use of multimapping in Dapper</a>  but only helps the Read part</p>