public override void Execute() { // Create the sub-tasks. if (UseDataRecordToBuild == null) { UseDataRecordToBuild = new UseDataRecordToBuild <T>(); } var objectList = new List <T>(); using (var dataReader = SelectCommand.ExecuteReader()) { while (dataReader.Read()) { UseDataRecordToBuild.DataRecord = dataReader; UseDataRecordToBuild.Execute(); objectList.Add(UseDataRecordToBuild.Object); } } ObjectsFetched = objectList.ToArray(); }
public override void Execute() { // Create the sub-tasks. if (UseDataRecordToBuild == null) { UseDataRecordToBuild = new UseDataRecordToBuild <T>(); } using (var dataReader = SelectCommand.ExecuteReader()) { // TODO - i don't trust this works in all cases... //if (!dataReader.Read()) // throw new SingleNotFoundException("No records were found."); //if(dataReader.Read()) // throw new SingleNotFoundException("More than one record was found."); dataReader.Read(); UseDataRecordToBuild.DataRecord = dataReader; UseDataRecordToBuild.Execute(); ObjectFetched = UseDataRecordToBuild.Object; } }