title: Component object-model tutorial?
body: <p>Does anyone know of a good tutorial (C# preferred) for creating a component's hierarchical object-model for .NET 3.0 or later i.e making full use of generics?</p>
  
  <ul>
  <li>work with and expose an indefinite number of contained objects;</li>
  <li>prevent client applications from directly instantiating contained objects;</li>
  <li>allow the client code to use 'tunnelling' style e.g. </li>
  </ul>
  
  <p><code>string columnName = db.Tables["Customers"].Columns["customer_number"].Name;</code></p>
  
  <p>I found this article, <a href="http://msdn.microsoft.com/en-us/library/1st5thkh(VS.71).aspx" rel="nofollow noreferrer">Component Object-Model Recommendations</a> but because it is for Visual Studio .NET 2003 but I'm thinking there are better ways in .NET 3.0.</p>
  
  <p>Thanks.</p>
  
  <p>UPDATE:</p>
  
  <p>If I've understood indexers correctly...</p>
  
  <p>In the <code>db</code> class, I could use a <code>SortedList</code> as container for Table and use and indexer to access to return a <code>Table</code> instance. Similarly, <code>Table</code>'s indexer would access a <code>Column</code> instance. So the client code could look like this:</p>
  
  <p><code>string tableName = db["Customers"].Name;</code></p>
  
  <p>The problem is, the <code>db</code> class exposes other collections in addition to <code>Tables</code> (<code>StoredProcs</code>, <code>DBViews</code>, etc). So I'm thinking I want to retain collection classes for each, exposing them as properties rather than using an indexer. Does this sound right? Should I use indexers on these collection classes, though? </p>