/// <summary>
        /// Converts the specified Data Table.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="dt">The dt.</param>
        /// <returns></returns>
        public List <T> Convert <T>(DataTable dt)
        {
            var list = new List <T>();

            if (dt.Rows.Count > 0)
            {
                IMapper <DataRow, T> mapperObject = new MapDispatcher().GetNewDataTableConvertorObject <T>(dt.Rows[0]);

                for (var i = 0; i < dt.Rows.Count; i++)
                {
                    list.Add(mapperObject.Convert(dt.Rows[i]));
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
        private static IEnumerable <T> ReadData <T>()
        {
            var mapperObject = new MapDispatcher().GetNewDataReaderConvertorObject <T>(_reader);

            using (_reader)
            {
                if (_reader.IsClosed)
                {
                    yield break;
                }
                while (_reader.HasRows && _reader.Read())
                {
                    yield return(mapperObject.Convert(_reader));
                }
            }
        }