Luke Smith Write today, wrong tomorrow

Creating a generic list from a SqlDataReader v1.1

Since writing the PopulateList method
I've made a few improvements, with some pointers from Erik

Firstly the interfaces can be passed a generic type, meaning IObjectPopulator
can be set to return a type T instead of a object type saving a cast in the PopulateList<T>

public interface IObjectPopulator<T>
   T Populate(IDataRecord

pointed me to using dr.GetOrdinal and the dr.Get*Type* methods inside the implementation
of the Populate(SqlDataReader) methods.

little helper method really has saved me quite alot of time writing the backend dataaccess,
and reduces the errors that copy and pasteing always introduces.

comments powered by Disqus