private void FillFileHistory(IDbConnection conn, IDbTransaction transaction) { var revisions = transaction .ExecuteQuery("select rev.ProjectId, rev.ReviewId, rev.Id, rev.RevisionNumber from dbo.Revisions rev") .ToList(x => new { ProjectId = (int)x["ProjectId"], ReviewId = (int)x["ReviewId"], RevisionId = (Guid)x["Id"], RevisionNumber = (int)x["RevisionNumber"] }) .GroupBy(x => new { x.ProjectId, x.ReviewId }); foreach (var revision in revisions) { FillHistoryForSingleReview(transaction, revision.Key.ProjectId, revision.Key.ReviewId, revision.OrderBy(x => x.RevisionNumber).Select(x => x.RevisionId).ToArray()); } }
List <FileEntry> FilesChangedInRevision(IDbTransaction transaction, Guid revisionId) { return(transaction.ExecuteQuery($"select OldPath, NewPath, IsNew, IsDeleted, IsRenamed from dbo.RevisionFiles where RevisionId = '{revisionId}'") .ToList(x => new FileEntry { OldPath = (string)x["OldPath"], NewPath = (string)x["NewPath"], IsNew = (bool)x["IsNew"], IsRenamed = (bool)x["IsRenamed"], IsDeleted = (bool)x["IsDeleted"], })); }