public async Task <Paging <NotificationRecipient> > ListNotificationRecipientsAsync(
            NotificationRecipientListRequest request,
            NotificationRecipientRetrievalOptions options = default,
            CancellationToken cancellationToken           = default)
        {
            var query = _context.NotificationRecipients
                        .WithOptions(options)
                        .AddFilter(request.Filter)
                        .AddOrder(request.OrderBy, request.Descending);

            if (request.Filter.AccessibleOnly)
            {
                query = await _notificationRecipientAccessControlService
                        .AddAccessFilterAsync(query, cancellationToken);
            }

            return(await Paging <Notification> .CreateAsync(query, request, cancellationToken));
        }
Beispiel #2
0
        public static IQueryable <NotificationRecipient> WithOptions(
            this IQueryable <NotificationRecipient> query,
            NotificationRecipientRetrievalOptions options)
        {
            if (!options.ForUpdate)
            {
                query = query.AsNoTracking();
            }

            if (options.LoadRegistration)
            {
                query = query.Include(r => r.Registration);
            }

            if (options.LoadUser)
            {
                query = query.Include(r => r.RecipientUser);
            }

            return(query);
        }