private IEnumerable <MediaLog> QueryFromFileSystem(IEnumerable <FileInfo> foundFiles) { List <MediaLog> foundMediaLogs = new List <MediaLog>(); foreach (FileInfo file in foundFiles) { string[] fileLines = File.ReadAllLines(file.FullName); foundMediaLogs.Add(new MediaLog( int.Parse(fileLines[0]), // id fileLines[1], // logText mediaItemDAO.FindById(int.Parse(fileLines[2])) // mediaItemId )); } return(foundMediaLogs); }
private IEnumerable <MediaLog> QueryMediaLogsFromDb(DbCommand command) { List <MediaLog> mediaLogList = new List <MediaLog>(); using (IDataReader reader = database.ExecuteReader(command)) { while (reader.Read()) { mediaLogList.Add(new MediaLog( (int)reader["Id"], (string)reader["LogText"], mediaItemDAO.FindById((int)reader["MediaItemId"]) )); } } return(mediaLogList); }