If I have a regular database table, with no rows, and I query it, I still get back some metadata, like the column names. Is this possible in EF 6, because if it returns an empty result set, it doesn't include a 'meta-row' I can use for column names.
Asked
Active
Viewed 115 times
-1
-
You state a fact and then ask "Is this possible?" I don't understand what you're asking. – Gert Arnold Aug 25 '16 at 22:21
1 Answers
0
That doesn't make any sense. EF never returns metadata about your table, it just returns a collect of objects whose type you know at compile time.
If you want the real metadata for the table you need to use something like Tortuga Chain. Or you can query the database's schema information tables.

Jonathan Allen
- 68,373
- 70
- 259
- 447
-
Yes, I realised that most of the time I have the type of the returned objects at compile time, and can iterate their properties, and even add metadata to them. However, I may not know the type at compile type if the query returns anonymous objects. – ProfK Aug 26 '16 at 08:27
-
So your question is really, "Given an empty `List
`, how do I use reflection to determine what class T is?" – Jonathan Allen Aug 26 '16 at 16:08 -
And the answer to that question: http://stackoverflow.com/a/557349/5274 – Jonathan Allen Aug 26 '16 at 16:10