When trying to create this linq statement. I ran into the following error:
Unable to cast object of type \'System.Data.Common.DataRecordInternal\' t
Try reader.Cast<DbDataRecord>
or reader.Cast<IDataRecord>
instead:
IEnumerable<TypeData> typeData = reader.Cast<IDataRecord>()
.Select(dr => new TypeData { Type = (string)dr["type"] });
IDataRecord Interface
Provides access to the column values within each row for a DataReader, and is implemented by .NET Framework data providers that access relational databases.