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

loresoft / MediatR.CommandQuery / 11937278774

20 Nov 2024 04:10PM CUT coverage: 59.17% (-0.1%) from 59.302%
11937278774

push

github

pwelter34
make HybridCache optional

389 of 745 branches covered (52.21%)

Branch coverage included in aggregate %.

0 of 6 new or added lines in 2 files covered. (0.0%)

1 existing line in 1 file now uncovered.

1208 of 1954 relevant lines covered (61.82%)

19.52 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

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

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

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

© 2025 Coveralls, Inc