title: Read Schema Name, Table Name and Column Name From a SQL DB and return to C# Code
body: <p>I have a DB (in SQL Server 2008 SP3) and need all Schema names, Table names and Column Names in related hierarchy in C# Code, I have the SQLElement Class as Following:</p>
  
  <pre><code> public class SQLElement
  {
      public string SchemaName { get; set; }
      public string TableName { get; set; }
      public string ColumnName { get; set; }
  }
  </code></pre>
  
  <p>And have a List Like:</p>
  
  <p><code>List&lt;SQLElement&gt; SQLElementCollection = new List&lt;SQLElement&gt;();</code></p>
  
  <p>So how can I read <strong>Names</strong> from DB and add them to this List (SQLElementCollection)?</p>
  
  <p>for example assume we create a table like this:</p>
  
  <pre><code>Create Table [General].[City] (
   [Id]           BIGINT          NOT NULL    IDENTITY(1, 1),
   [Title]        NVARCHAR(30)    NOT NULL    DEFAULT (N''),
   [Province_Id]  BIGINT          NOT NULL
  )
  </code></pre>
  
  <p>and I need the list like:</p>
  
  <pre><code>[0]={SchemaName="General", TableName="City", ColumnName="Id"} 
  [1]={SchemaName="General", TableName="City", ColumnName="Title"} 
  [2]={SchemaName="General", TableName="City", ColumnName="Province_Id"} 
  </code></pre>
  
  <p>Does any one have any idea about this?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>In next step how we can get the type of each column or related properties?</p>