title: Design pattern for mapping database in Data Access Layer [C#]
body: <p>I work on my Data Access Layer where I use data mapper pattern. My actual structure of code is for example:</p>
  
  <pre><code>public class Person {
      public int Age
      public string FirstName
      public string LastName
      public List&lt;Address&gt; Addresses
      ...
  }
  
  public class PersonMapper {
      public Person GetPersonById(int id)
      public List&lt;Person&gt; GetAll()
      public bool UpdatePerson(Person person)
      ...
  }
  </code></pre>
  
  <p>I have so many classes which are corresponding for database table with same name.</p>
  
  <p>My questions are:</p>
  
  <ol>
  <li><p>Is my approach right? When I mapped all tables, I will use it in the domain layer.</p></li>
  <li><p>In Mapper classes I use methods which are working only with tables which are same name as these classes. (<code>Person</code> class -> Persons db table, <code>Order</code> class -> Orders db table, etc.) But what is the best way to map advanced selects from database, which will be contains joins to more tables. For example I want select <code>Person</code> with all his <code>Orders.</code> Should I create domain model for Person which will be contains property <code>List&lt;Orders&gt;</code>and use <code>PersonMapper</code> and next <code>OrderMapper</code>?</p></li>
  </ol>