title: Dynamic object not showing its methods
body: <p>I am trying to convert the ffg:,</p>
  
  <p><strong>This Works</strong></p>
  
  <pre><code>IResultSEt rs =    db.SELECT.COLUMNS(db.GetTable(data.ToString()).ColumnNames).FROM(data.ToString()).Execute();
  </code></pre>
  
  <p>into this, which does not work,</p>
  
  <pre><code>dynamic rs = db.SELECT.COLUMNS(db.GetTable(data.ToString()).ColumnNames);
             rs = rs.FROM(data.ToString());
             rs = rs.Execute();
  </code></pre>
  
  <p>It gives me an error that it cannot find "COLUMNS".</p>
  
  <p>While debugging, it seems that <strong><em>rs</em></strong> is picking up all the <strong>return methods</strong> and <strong>private variables</strong> in the SELECT class it just is not picking up the method like COLUMNS in the SELECT class at runtime. This is very odd, I expected it to also pick up the methods, I am doing something wrong???</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The definition for <strong>db</strong> in   <strong>db</strong>.SELECT.COLUMNS(db.GetTable(data.ToString()).ColumnNames); is</p>
  
  <pre><code> public class Database
  {
      private Dictionary&lt;string, ITable&gt; _tables = new Dictionary&lt;string, ITable&gt;();
  
      public ITable AddTable(string tableName, string[]columnNames, Type[] columnTypes)
      {
          ITable tbl = new Table(tableName);
          tbl.SetColumns(columnNames, columnTypes);
          _tables.Add(tableName.ToUpper(), tbl);
  
          return tbl;
      }
  
      public ITable GetTable(string tableName)
      {
          return _tables[tableName.ToUpper()];
      }
  
      public ISELECT SELECT
      {
          get
          {
              ISELECT select = new SELECT(this);
              return select;
          }
      }
  
      public Dictionary&lt;string,ITable&gt; getTables()
      {
          return _tables;
      }
  }
  </code></pre>
  
  <p>The definition for <strong>SELECT</strong> in   db.<strong>SELECT</strong>.COLUMNS(db.GetTable(data.ToString()).ColumnNames); which is an interface to my <strong>SELECT</strong> class;</p>
  
  <pre><code>public interface ISELECT
  {
      ISELECT TOP(Int32 N);
      ISELECT DISTINCT { get; }
      ISELECTCOLUMN COLUMN(string columnName);
      ISELECTTABLECOLUMN COLUMN(string tableName, string columnName);
      ISELECTCOLUMNS COLUMNS(params string[] columnNames);
      ISELECTSUMCOLUMN SUM(string columnName);
      ISELECTSUMCOLUMN SUM(string tableName, string columnName);
  }
  </code></pre>
  
  <p>This is where the problem lies, the dynamic object is not picking up the methods in the interface, it picks up all private variables and the only method it picks up is <strong>"DISTINCT"</strong>.</p>
  
  <p>Below is part of the definition of the SELECT class, there is alot of code in it so I will just put a little;</p>
  
  <pre><code>internal class SELECT : ISELECT, ISELECTInternals
  {
      private Database _dw;
      private bool _DISTINCT;
      private Int32 _TOPN = -1;
      private List&lt;Int32&gt; _JOINNumbers = new List&lt;Int32&gt;();
      private string[] _selectJOINLHScolumnTableNames;
      private string[] _selectJOINLHScolumnNames;
      private string[] _selectJOINRHScolumnTableNames;
      private string[] _selectJOINRHScolumnNames;
      private string[] _selectcolumnTableNames;
      private string[] _selectcolumnNames;
      private string[] _selectcolumnAliases;
      private object[] _selectcolumnLiterals;
      private string[] _selectcolumnStringTemplates;
      private AggregateTypes[] _selectcolumnAggregates;
      private string[] _queryTableNames;
      private string _SUMcolumnName;
      private string _FROMTableName;
      private List&lt;string&gt; _INNERJOINTableNames = new List&lt;string&gt;();
      private List&lt;string&gt; _JOINTableNames = new List&lt;string&gt;();
      private List&lt;JoinTypes&gt; _TableJoinTypes = new List&lt;JoinTypes&gt;();
      private bool _takeANDFlag = true;
      private List&lt;string&gt; _filterColumnTableNames = new List&lt;string&gt;();
      private List&lt;string&gt; _filterColumnNames = new List&lt;string&gt;();
      private List&lt;object[]&gt; _filterColumnValues = new List&lt;object[]&gt;();
      private List&lt;string&gt; _GROUPBYcolumnTableNames = new List&lt;string&gt;();
      private List&lt;string&gt; _GROUPBYcolumnNames = new List&lt;string&gt;();
  </code></pre>
  
  <p>etc.</p>