title: Working with sql server metadata in c#
body: <p>Are there any tools out there that encapsulate the retrieval of SQL Server metadata into a nice object model?</p>
  
  <p>My immediate needs are to gather these things from SQL Server 2000-2008 R2:</p>
  
  <ul>
  <li>Databases</li>
  <li>Tables</li>
  <li>Foreign key constraints</li>
  <li>Triggers</li>
  </ul>
  
  <p>So, maybe given a SqlConnection object, I could do things like this:</p>
  
  <pre><code>var dbs = conn.GetDatabases();
  var db = dbs.Single(x =&gt; x.Name == "AdventureWorks");
  var tables = db.GetTables();
  var triggers = db.GetAllTriggers();
  </code></pre>
  
  <p>Of course, those examples would be very convenient, but any sort of object model would be better than what I'm doing now. Before I build my own, is there anything out there?</p>