示例#1
0
        private static async Task <List <T> > ReadSqlServerSpecificListAsync <T>(
            SqlDataReaderShim sqlReader,
            ISqlMap <T> sqlMap,
            List <T> list)
            where T : new()
        {
            while (await sqlReader.ReadAsync())
            {
                var item = LoadItemWithSqlServerSpecificField(sqlReader, sqlMap);
                list.Add(item);
            }

            return(list);
        }
示例#2
0
        private static async Task <Dictionary <TKey, List <T> > > ReadSqlServerSpecificDictionaryAsync <T, TKey>(
            SqlDataReaderShim sqlReader,
            int keyOrdinal,
            Dictionary <TKey, List <T> > result,
            ISqlMap <T> sqlMap)
            where T : new()
        {
            while (await sqlReader.ReadAsync())
            {
                var      key = (TKey)sqlReader.GetValue(keyOrdinal);
                List <T> list;
                if (result.TryGetValue(key, out list) == false)
                {
                    list        = new List <T>();
                    result[key] = list;
                }

                var item = LoadItemWithSqlServerSpecificField(sqlReader, sqlMap);
                list.Add(item);
            }

            return(result);
        }