public static async Task <LightDataTable> CreateAsync(DbDataReader reader)
        {
            if (reader.IsNull())
            {
                throw new ArgumentNullException(nameof(reader));
            }

            var result = new LightDataTable();

            if (!await reader.ReadAsync())
            {
                try { result.Columns.Add(reader); }
                catch (Exception) { }
                return(result);
            }

            result.Columns.Add(reader);
            await result.Rows.AddAsync(reader);

            return(result);
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of LightDataColumnCollection.
 /// </summary>
 /// <param name="dataTable">A LightDataTable that the collection belongs to.</param>
 internal LightDataColumnCollection(LightDataTable dataTable)
 {
     _dataTable = dataTable;
     _list      = new List <LightDataColumn>();
 }
 /// <summary>
 /// Initializes a new instance of LightDataRowCollection.
 /// </summary>
 /// <param name="dataTable">A LightDataTable that the collection belongs to.</param>
 internal LightDataRowCollection(LightDataTable dataTable)
 {
     _dataTable = dataTable;
     _list      = new List <LightDataRow>();
 }