我想給FFG轉換:,動態對象沒有顯示
這個作品
IResultSEt rs = db.SELECT.COLUMNS(db.GetTable(data.ToString()).ColumnNames).FROM(data.ToString()).Execute();
到這一點,這是不行的,
dynamic rs = db.SELECT.COLUMNS(db.GetTable(data.ToString()).ColumnNames);
rs = rs.FROM(data.ToString());
rs = rs.Execute();
它給它的方法我找不到「COLUMNS」的錯誤。
調試時,似乎RS是撿了所有的迴歸方法和私有變量在SELECT類,它只是不拿起方法就像在運行時在SELECT班列。這很奇怪,我預料它也會拿起方法,我做錯了什麼?
UPDATE
在分貝 .SELECT.COLUMNS(db.GetTable(data.ToString())COLUMNNAMES。)爲分貝定義;是
public class Database
{
private Dictionary<string, ITable> _tables = new Dictionary<string, ITable>();
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<string,ITable> getTables()
{
return _tables;
}
}
爲定義選擇在DB。 SELECT .COLUMNS(db.GetTable(data.ToString())。ColumnNames);這是我的一個接口SELECT class;
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);
}
這就是問題所在,動態對象不拾取在接口中的方法,它拿起所有的私有變量和它拿起的唯一方法是「DISTINCT」。
下面是SELECT類定義的一部分,裏面有很多代碼,所以我只是稍微放一下;
internal class SELECT : ISELECT, ISELECTInternals
{
private Database _dw;
private bool _DISTINCT;
private Int32 _TOPN = -1;
private List<Int32> _JOINNumbers = new List<Int32>();
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<string> _INNERJOINTableNames = new List<string>();
private List<string> _JOINTableNames = new List<string>();
private List<JoinTypes> _TableJoinTypes = new List<JoinTypes>();
private bool _takeANDFlag = true;
private List<string> _filterColumnTableNames = new List<string>();
private List<string> _filterColumnNames = new List<string>();
private List<object[]> _filterColumnValues = new List<object[]>();
private List<string> _GROUPBYcolumnTableNames = new List<string>();
private List<string> _GROUPBYcolumnNames = new List<string>();
等
當我們對實現一無所知時,很難提供幫助。你能提供更多的信息,還是理想的簡短但完整的例子?你在任何地方使用顯式接口實現嗎? –
@Jon我編輯了我的帖子,如果你需要更多的信息讓我知道,不想粘貼很多代碼,可能會變得不可讀。 – Dreamer78692
需要關於什麼是失敗的更多細節。 ISELECTCOLUMNS接口定義了什麼? – Hagashen