title: Where do objects merge/join data in a 3-tier model?
body: <p>Its probarbly a simple 3-tier problem. I just want to make sure we use the best practice for this and I am not that familiary with the structures yet.</p>
  
  <p><strong>We have the 3 tiers:</strong></p>
  
  <ul>
  <li>GUI: ASP.NET for Presentation-layer (first platform)</li>
  <li>BAL: Business-layer will be handling the logic on a webserver in C#, so we both can use it for webforms/MVC + webservices</li>
  <li>DAL: LINQ to SQL in the Data-layer, returning BusinessObjects not LINQ. </li>
  <li>DB: The SQL will be Microsoft SQL-server/Express (havent decided yet).</li>
  </ul>
  
  <p>Lets think of setup where we have a database of [Persons]. They can all have multiple [Address]es and we have a complete list of all [PostalCode] and corresponding citynames etc.</p>
  
  <p>The deal is that we have joined a lot of details from other tables.</p>
  
  <p><strong>{Relations}/[tables]</strong></p>
  
  <ul>
  <li>[Person]:1 --- N:{PersonAddress}:M --- 1:[Address]</li>
  <li>[Address]:N --- 1:[PostalCode] </li>
  </ul>
  
  <p>Now we want to build the DAL for Person. How should the PersonBO look and when does the joins occure?
  Is it a business-layer problem to fetch all citynames and possible addressses pr. Person? or should the DAL complete all this before returning the PersonBO to the BAL ? </p>
  
  <pre><code>Class PersonBO 
  {
      public int ID {get;set;}
      public string Name {get;set;}
      public List&lt;AddressBO&gt; {get;set;} // Question #1
  } 
  </code></pre>
  
  <p>// Q1: do we retrieve the objects before returning the PersonBO and should it be an Array instead? or is this totally wrong for n-tier/3-tier??</p>
  
  <pre><code>Class AddressBO 
  {
      public int ID {get;set;}
      public string StreetName {get;set;}
      public int PostalCode {get;set;} // Question #2
  } 
  </code></pre>
  
  <p>// Q2: do we make the lookup or just leave the PostalCode for later lookup?</p>
  
  <p>Can anyone explain in what order to pull which objects? Constructive criticism is very welcome. :o)</p>