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

loresoft / MediatR.CommandQuery / 12567339125

01 Jan 2025 04:52AM UTC coverage: 60.229% (-0.1%) from 60.328%
12567339125

push

github

pwelter34
switch to Testcontainers

402 of 761 branches covered (52.83%)

Branch coverage included in aggregate %.

1282 of 2035 relevant lines covered (63.0%)

19.24 hits per line

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

83.33
/src/MediatR.CommandQuery/Commands/EntityUpsertCommand.cs
1
using System.Diagnostics.CodeAnalysis;
2
using System.Security.Claims;
3

4
using MediatR.CommandQuery.Definitions;
5
using MediatR.CommandQuery.Services;
6

7
namespace MediatR.CommandQuery.Commands;
8

9
/// <summary>
10
/// A command to create or update the entity with the specified identifier.
11
/// </summary>
12
/// <typeparam name="TKey">The type of the key.</typeparam>
13
/// <typeparam name="TUpdateModel">The type of the update model.</typeparam>
14
/// <typeparam name="TReadModel">The type of the read model.</typeparam>
15
public record EntityUpsertCommand<TKey, TUpdateModel, TReadModel>
16
    : EntityModelCommand<TUpdateModel, TReadModel>, ICacheExpire
17
{
18
    /// <summary>
19
    /// Initializes a new instance of the <see cref="EntityUpsertCommand{TKey, TUpdateModel, TReadModel}"/> class.
20
    /// </summary>
21
    /// <param name="principal">the <see cref="ClaimsPrincipal" /> this command is run for</param>
22
    /// <param name="id">The identifier to apply the update to.</param>
23
    /// <param name="model">The update model to apply.</param>
24
    /// <exception cref="System.ArgumentNullException">When <paramref name="id"/> or <paramref name="model"/> is null</exception>
25
    public EntityUpsertCommand(ClaimsPrincipal? principal, [NotNull] TKey id, TUpdateModel model) : base(principal, model)
16✔
26
    {
27
        ArgumentNullException.ThrowIfNull(id);
16✔
28

29
        Id = id;
16✔
30
    }
16✔
31

32
    /// <summary>
33
    /// Gets the identifier for entity to update.
34
    /// </summary>
35
    /// <value>
36
    /// The identifier for entity to update.
37
    /// </value>
38
    [NotNull]
39
    public TKey Id { get; }
32✔
40

41
    /// <inheritdoc />
42
    string? ICacheExpire.GetCacheTag()
43
        => CacheTagger.GetTag<TReadModel>();
×
44
}
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