public IEnumerable <T> Enumerate(IDbCodeDataReader dataReader) { var core = dataReader.Core as NpgsqlDataReader; if (core == null) { throw new ApplicationException(); } if (core.FieldCount != (_AssignedProperties != null ? _AssignedProperties.Length : 1)) { 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); } }
/// <summary> /// コンストラクタ、全要素を指定して初期化する /// </summary> /// <param name="dataReader">DBからのデータ読み取りオブジェクト</param> /// <param name="recordReader"><see cref="DataReader"/>から<typeparamref name="T"/>型のレコードを列挙するオブジェクト</param> public RecordEnumerator(IDbCodeDataReader dataReader, IRecordReader <T> recordReader) { this.DataReader = dataReader; this.RecordReader = recordReader; }