DataUtils.DataReaderToObjectList<T>

Creates a list of a given type from all the rows in a DataReader.

Note this method uses Reflection so this isn't a high performance operation, but it can be useful for generic data reader to entity conversions on the fly and with anonymous types.

public static List<T> DataReaderToObjectList<T>(IDataReader reader,
	string fieldsToSkip,
	Dictionary<String,PropertyInfo> piList)

Parameters

reader
An open DataReader that's in position to read

fieldsToSkip
Optional - comma delimited list of fields that you don't want to update

piList
Optional - Cached PropertyInfo dictionary that holds property info data for this object. Can be used for caching hte PropertyInfo structure for multiple operations to speed up translation. If not passed automatically created.

Remarks

DataReader is not closed by this method. Make sure you call reader.close() afterwards


See also:

Class DataUtils

© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic