DataUtils.DataReaderToObject

Populates the properties of an object from a single DataReader row using Reflection by matching the DataReader fields to a public property on the object passed in. Unmatched properties are left unchanged.

You need to pass in a data reader located on the active row you want to serialize.

This routine works best for matching pure data entities and should be used only in low volume environments where retrieval speed is not critical due to its use of Reflection.

public static void DataReaderToObject(IDataReader reader,
	object instance,
	string fieldsToSkip,
	Dictionary<String,PropertyInfo> piList)

Parameters

reader
Instance of the DataReader to read data from. Should be located on the correct record (Read() should have been called on it before calling this method)

instance
Instance of the object to populate properties on

fieldsToSkip
Optional - A comma delimited list of object properties that should not be updated

piList
Optional - Cached PropertyInfo dictionary that holds property info data for this object


See also:

Class DataUtils

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