title: How to make an algorithm to get all column names from across tables that relations with their primary key in SQL Server and C#?
body: <p>I have 3 tables (for example 3, but in real over than 30 tables with this conditions) in my SQL Server database: post, user, person.</p>
  
  <ul>
  <li><code>post</code>: (post_id, post_text, user_id)</li>
  <li><code>user</code>: (user_id, user_name, person_id)</li>
  <li><code>person</code>: (person_id, person_phone, person_email)</li>
  </ul>
  
  <p>Now, in C#, I want an algorithm that creates a query that get result like this:</p>
  
  <pre><code>post.post_id, post.post_text, post.user_id, user.user_id, user.user_name, user.person_id, person.person_id, person.person_email
  </code></pre>
  
  <p>and I use this method for fill a <code>SqlDataReader</code> in C# for reading and accessing all column values from these records.</p>
  
  <p>I know that the common way to get that result directly and manually using of 'Join' statement, but it is waste time if tables count is very much. So, I want an algorithm that generates this query for manipulate in C# programming.</p>
  
  <p>Thanks a lot.</p>