Пример #1
0
        public T ToSingle(DataRow row)
        {
            EntityDescription description = EntityDescriptionCache.Get(typeof(T));
            DataTable         table       = row.Table;

            return(GetSingle(row, description, table));
        }
Пример #2
0
        public List <T> ToList(DataTable table)
        {
            EntityDescription description = EntityDescriptionCache.Get(typeof(T));

            List <T> list = new List <T>(Initializer.Instance.DefaultEntityListLen);

            foreach (DataRow row in table.Rows)
            {
                T instance = GetSingle(row, description, table);
                list.Add(instance);
            }
            return(list);
        }
Пример #3
0
        public T ToSingle(DbDataReader reader)
        {
            if (reader.Read())
            {
                EntityDescription description = EntityDescriptionCache.Get(typeof(T));
                string[]          names       = DataExtensions.GetColumnNames(reader);

                return(GetSingle(reader, description, names));
            }
            else
            {
                return(default(T));
            }
        }
Пример #4
0
        public List <T> ToList(DbDataReader reader)
        {
            EntityDescription description = EntityDescriptionCache.Get(typeof(T));

            return(ToList(reader, description));
        }