Check-in [a28a3e8d4e]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge dotnet into dotnet/timers.
Timelines: family | ancestors | mistake
Files: files | file ages | folders
SHA1: a28a3e8d4e69aa24aa56d51858211279fdabe705
User & Date: tinus 2019-09-26 07:24:55
Context
2019-09-26
07:24
Merge dotnet into dotnet/timers. Leaf check-in: a28a3e8d4e user: tinus tags: mistake
07:24
GetMaxUID now errors out if there's no message in the folder. Leaf check-in: 1e5a065664 user: tinus tags: dotnet/nullable
06:55
Merge dotnet into dotnet/timers. check-in: c3c2517228 user: tinus tags: mistake
Changes

Changes to Repositories/FolderMessagesRepository.cs.

12
13
14
15
16
17
18
19
20
21
22
23

24





25
26
27
28
29
30
31
        internal FolderMessagesRepository(MailJanitorContext db, CancellationToken cancellationToken = default) : base(db, cancellationToken)
        {
        }

        /// <summary>
        /// Retrieves the highest UID in the given <paramref name="folder"/>.
        /// </summary>
        public Task<uint> GetMaxUIDAsync(Folder folder)
        {
            return _db.FolderMessages
                .Where(fm => fm.Folder == folder)
                .DefaultIfEmpty()

                .MaxAsync(fm => fm == null ? 0 : fm.UID, _cancellationToken);





        }

        /// <summary>
        /// Retrieves a list of <see cref="FolderMessage.ID"/>s and <see cref="Message.ID"/>s matching the given
        /// <paramref name="globalIDs"/> in the given <paramref name="dbFolderID"/>.
        /// </summary>
        /// <param name="dbFolderID">The ID of the folder containing those messages.</param>







|

|
|
|
>
|
>
>
>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
        internal FolderMessagesRepository(MailJanitorContext db, CancellationToken cancellationToken = default) : base(db, cancellationToken)
        {
        }

        /// <summary>
        /// Retrieves the highest UID in the given <paramref name="folder"/>.
        /// </summary>
        public async Task<uint> GetMaxUIDAsync(Folder folder)
        {
            var folderMessages = _db.FolderMessages
                .Where(fm => fm.Folder == folder);
            if (await folderMessages.AnyAsync())
            {
                return await folderMessages.MaxAsync(fm => fm.UID, _cancellationToken);
            }
            else
            {
                return uint.MinValue;
            }
        }

        /// <summary>
        /// Retrieves a list of <see cref="FolderMessage.ID"/>s and <see cref="Message.ID"/>s matching the given
        /// <paramref name="globalIDs"/> in the given <paramref name="dbFolderID"/>.
        /// </summary>
        /// <param name="dbFolderID">The ID of the folder containing those messages.</param>