/// <summary> /// Initializes a new instance of the VDataEntityList class. /// VDataEntityList implemented as case insensitive ListDictionary under hood. /// </summary> /// <param name="reader">Provides a way of reading a forward-only stream of rows from a SQL Server database</param> /// <returns>Initialized a new instance of the VDataEntityList class</returns> public static VDataEntityList Load(DbDataReader reader) { var list = new VDataEntityList(); if (reader != null && reader.HasRows && reader.Read()) { list = new VDataEntityList(); for (int i = 0; i < reader.FieldCount; i++) { list.Add(reader.GetName(i), reader.GetValue(i)); } } return list; }
/// <summary> /// Initializes a new instance of the VDataEntityList class using data from DataRow. /// </summary> /// <param name="row">DataRow containing data</param> /// <returns>Initialized a new instance of the VDataEntityList class</returns> public static VDataEntityList Load(DataRow row) { var list = new VDataEntityList(); if (row != null) { DataColumnCollection columnCollection = row.Table.Columns; if (columnCollection.Count > 0) { object[] rowitems = row.ItemArray; for (int i = 0; i < columnCollection.Count; i++) { list.Add(columnCollection[i].Caption, rowitems[i]); } } } return list; }