コード例 #1
0
        public IEnumerable <T> Enumerate(ICodeDbDataReader dataReader)
        {
            var core = dataReader.Core as NpgsqlDataReader;

            if (core == null)
            {
                throw new ApplicationException();
            }
            if (core.FieldCount != _AssignedProperties.Length)
            {
                throw new ApplicationException();
            }
            var getter = _Getter;

            while (core.Read())
            {
                T result;
                try {
                    result = getter(core);
                } catch (PostgresException ex) {
                    throw new PgEnvironmentException(ex);
                }
                yield return(result);
            }
        }
コード例 #2
0
ファイル: RecordEnumerator.cs プロジェクト: nQuantums/tips
 /// <summary>
 /// コンストラクタ、全要素を指定して初期化する
 /// </summary>
 /// <param name="dataReader">DBからのデータ読み取りオブジェクト</param>
 /// <param name="recordReader"><see cref="DataReader"/>から<typeparamref name="T"/>型のレコードを列挙するオブジェクト</param>
 public RecordEnumerator(ICodeDbDataReader dataReader, IRecordReader <T> recordReader)
 {
     this.DataReader   = dataReader;
     this.RecordReader = recordReader;
 }