Beispiel #1
0
        protected List <T> GetList <T>(IDataReader reader, int StartIndex, int MaxRecord)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }
            List <T>    list = new List <T>();
            IDataReader Dr   = reader;

            if (Dr.FieldCount > 0)
            {
                while (StartIndex > 0)
                {
                    if (!Dr.Read())
                    {
                        return(list);
                    }
                    StartIndex--;
                }
                var create = ODAReflection.GetCreator <T>(Dr);
                while (Dr.Read())
                {
                    list.Add(create(Dr));
                    MaxRecord--;
                }
            }
            return(list);
        }
Beispiel #2
0
        private static List <T> ReadData <T>(IDataReader Dr)
        {
            List <T> list = new List <T>();

            if (Dr.FieldCount > 0)
            {
                var create = ODAReflection.GetCreator <T>(Dr);
                while (Dr.Read())
                {
                    list.Add(create(Dr));
                }
            }
            return(list);
        }