• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

loresoft / MediatR.CommandQuery / 11418431610

19 Oct 2024 02:43PM UTC coverage: 58.337% (+0.9%) from 57.424%
11418431610

push

github

pwelter34
add HybridCache, misc refactors

331 of 675 branches covered (49.04%)

Branch coverage included in aggregate %.

28 of 176 new or added lines in 24 files covered. (15.91%)

156 existing lines in 33 files now uncovered.

1163 of 1886 relevant lines covered (61.66%)

19.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/MediatR.CommandQuery.Cosmos/Handlers/EntityIdentifierQueryHandler.cs
1
using AutoMapper;
2

3
using Cosmos.Abstracts;
4

5
using MediatR.CommandQuery.Definitions;
6
using MediatR.CommandQuery.Queries;
7

8
using Microsoft.Extensions.Logging;
9

10
namespace MediatR.CommandQuery.Cosmos.Handlers;
11

12
public class EntityIdentifierQueryHandler<TRepository, TEntity, TReadModel>
13
    : RepositoryHandlerBase<TRepository, TEntity, EntityIdentifierQuery<string, TReadModel>, TReadModel>
14
    where TRepository : ICosmosRepository<TEntity>
15
    where TEntity : class, IHaveIdentifier<string>, new()
16
{
17
    public EntityIdentifierQueryHandler(ILoggerFactory loggerFactory, TRepository repository, IMapper mapper) : base(loggerFactory, repository, mapper)
×
18
    {
19
    }
×
20

21
    protected override async Task<TReadModel> Process(EntityIdentifierQuery<string, TReadModel> request, CancellationToken cancellationToken)
22
    {
23
        ArgumentNullException.ThrowIfNull(request);
×
24
        if (!CosmosKey.TryDecode(request.Id, out var id, out var partitionKey))
×
25
            throw new InvalidOperationException("Invalid Cosmos Key format");
×
26

UNCOV
27
        var entity = await Repository
×
28
            .FindAsync(id, partitionKey, cancellationToken)
×
29
            .ConfigureAwait(false);
×
30

31
        // convert deleted entity to read model
UNCOV
32
        var model = Mapper.Map<TReadModel>(entity);
×
33

UNCOV
34
        return model;
×
35
    }
×
36
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc