コード例 #1
0
ファイル: GridReader.cs プロジェクト: chenmsg/sujin
 internal GridReader(IDbCommand command, IDataReader reader, Identity identity, DynamicParameters dynamicParams, CancellationToken cancel)
     : this(command, reader, identity, dynamicParams)
 {
     this.cancel = cancel;
 }
コード例 #2
0
ファイル: GridReader.cs プロジェクト: chenmsg/sujin
        private async Task <IEnumerable <T> > ReadBufferedAsync <T>(int index, Func <IDataReader, object> deserializer, Identity typedIdentity)
        {
            //try
            //{
            var      reader = (DbDataReader)this.reader;
            List <T> buffer = new List <T>();

            while (index == gridIndex && await reader.ReadAsync(cancel).ConfigureAwait(false))
            {
                buffer.Add((T)deserializer(reader));
            }
            if (index == gridIndex) // need to do this outside of the finally pre-C#6
            {
                await NextResultAsync().ConfigureAwait(false);
            }
            return(buffer);
            //}
            //finally // finally so that First etc progresses things even when multiple rows
            //{
            //    if (index == gridIndex)
            //    {
            //        await NextResultAsync().ConfigureAwait(false);
            //    }
            //}
        }
コード例 #3
0
ファイル: GridReader.cs プロジェクト: chenmsg/sujin
 public IEnumerable <T> ReadDeferred <T>(int index, Func <IDataReader, object> deserializer, Identity typedIdentity)
 {
     try
     {
         while (index == gridIndex && reader.Read())
         {
             yield return((T)deserializer(reader));
         }
     }
     finally     // finally so that First etc progresses things even when multiple rows
     {
         if (index == gridIndex)
         {
             NextResult();
         }
     }
 }