I have the follofing code:
...
string curTable = "DTMConsole.DataModels";
var s = wtcDb.GetTable(Type.GetType(curTable));
PropertyInfo[] pList = s.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public);
foreach (var p in pList)
{
System.Console.Write(p.GetValue(s, null).ToString());
}
…
wtcDb is a DataContext. DataModels is an Entity Table. I’m trying to get the list of all elements (properties) in the s. But it simple doesn’t work. I get 2 Properties at all. 1 is the name of the DataContext and the other is a Bool (readOnly). But the class DataModels is much more wider.
How to iterate correctly through the ITable even though the incoming parameters are not strongly typed ?
You are referencing the ITable’s property.