I know about ObjectContext.ExecuteStoreQuery<T>(), but is it possible to use that method (or other methods) when you don’t know the return entity before running the query?
Example:
select * from [tablename] where [tablename]
can be any table in my database and the columns can be of any type?
Or should I just use the good old SqlConnection, SqlCommand and DataReader?:)
In such case you should use standard ADO.NET.
ExecuteStoreQueryexpects type (either entity, complex type or custom type) as generic parameter. The instance of this type will be used for mapping result’s columns to properties of the type. If you don’t know the type upfront you cannot use the method.