< Summary

Information
Class: AsiBackbone.EntityFrameworkCore.Configurations.AsiBackboneGovernanceOutboxEntryEntityConfiguration
Assembly: AsiBackbone.EntityFrameworkCore
File(s): /home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.EntityFrameworkCore/Configurations/AsiBackboneGovernanceOutboxEntryEntityConfiguration.cs
Line coverage
100%
Covered lines: 179
Uncovered lines: 0
Coverable lines: 179
Total lines: 289
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
Configure(...)100%11100%

File(s)

/home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.EntityFrameworkCore/Configurations/AsiBackboneGovernanceOutboxEntryEntityConfiguration.cs

#LineLine coverage
 1using AsiBackbone.EntityFrameworkCore.Persistence;
 2using Microsoft.EntityFrameworkCore;
 3using Microsoft.EntityFrameworkCore.Metadata.Builders;
 4using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 5
 6namespace AsiBackbone.EntityFrameworkCore.Configurations;
 7
 8/// <summary>
 9/// Configures the Entity Framework Core persistence mapping for <see cref="AsiBackboneGovernanceOutboxEntryEntity" />.
 10/// </summary>
 11public sealed class AsiBackboneGovernanceOutboxEntryEntityConfiguration
 12    : IEntityTypeConfiguration<AsiBackboneGovernanceOutboxEntryEntity>
 13{
 14    private const int IdentifierMaxLength = 128;
 15    private const int SchemaVersionMaxLength = 64;
 16    private const int StatusMaxLength = 128;
 17    private const int ProviderMaxLength = 128;
 18    private const int ErrorCodeMaxLength = 128;
 19    private const int ProviderErrorCodeMaxLength = 128;
 20    private const int StageMaxLength = 128;
 21    private const int OperationNameMaxLength = 256;
 22    private const int OutcomeMaxLength = 128;
 23    private const int PolicyVersionMaxLength = 128;
 24    private const int HashMaxLength = 512;
 25    private const int ContentTypeMaxLength = 256;
 26    private const int PayloadTypeMaxLength = 128;
 27    private const int ConcurrencyStampMaxLength = 64;
 28
 229    private static readonly ValueConverter<DateTimeOffset, long> DateTimeOffsetToUtcTicksConverter = new(
 230        value => value.ToUniversalTime().Ticks,
 231        value => new DateTimeOffset(value, TimeSpan.Zero));
 32
 233    private static readonly ValueConverter<DateTimeOffset?, long?> NullableDateTimeOffsetToUtcTicksConverter = new(
 234        value => value.HasValue ? value.Value.ToUniversalTime().Ticks : null,
 235        value => value.HasValue ? new DateTimeOffset(value.Value, TimeSpan.Zero) : null);
 36
 37    /// <inheritdoc />
 38    public void Configure(EntityTypeBuilder<AsiBackboneGovernanceOutboxEntryEntity> builder)
 39    {
 3640        ArgumentNullException.ThrowIfNull(builder);
 41
 3642        _ = builder.ToTable("AsiBackboneGovernanceOutboxEntries");
 43
 3644        _ = builder.HasKey(outboxEntry => outboxEntry.Id);
 45
 3646        _ = builder.Property(outboxEntry => outboxEntry.Id)
 3647            .ValueGeneratedNever();
 48
 3649        _ = builder.Property(outboxEntry => outboxEntry.ConcurrencyStamp)
 3650            .IsRequired()
 3651            .HasMaxLength(ConcurrencyStampMaxLength)
 3652            .IsConcurrencyToken();
 53
 3654        _ = builder.Property(outboxEntry => outboxEntry.OutboxEntryId)
 3655            .IsRequired()
 3656            .HasMaxLength(IdentifierMaxLength);
 57
 3658        _ = builder.Property(outboxEntry => outboxEntry.Status)
 3659            .HasConversion<string>()
 3660            .IsRequired()
 3661            .HasMaxLength(StatusMaxLength);
 62
 3663        _ = builder.Property(outboxEntry => outboxEntry.CreatedUtc)
 3664            .HasConversion(DateTimeOffsetToUtcTicksConverter)
 3665            .IsRequired();
 66
 3667        _ = builder.Property(outboxEntry => outboxEntry.UpdatedUtc)
 3668            .HasConversion(DateTimeOffsetToUtcTicksConverter)
 3669            .IsRequired();
 70
 3671        _ = builder.Property(outboxEntry => outboxEntry.DeliveredUtc)
 3672            .HasConversion(NullableDateTimeOffsetToUtcTicksConverter);
 73
 3674        _ = builder.Property(outboxEntry => outboxEntry.NextRetryUtc)
 3675            .HasConversion(NullableDateTimeOffsetToUtcTicksConverter);
 76
 3677        _ = builder.Property(outboxEntry => outboxEntry.RetryCount)
 3678            .IsRequired();
 79
 3680        _ = builder.Property(outboxEntry => outboxEntry.MaxRetryCount)
 3681            .IsRequired();
 82
 3683        _ = builder.Property(outboxEntry => outboxEntry.ProviderName)
 3684            .HasMaxLength(ProviderMaxLength);
 85
 3686        _ = builder.Property(outboxEntry => outboxEntry.ProviderRecordId)
 3687            .HasMaxLength(IdentifierMaxLength);
 88
 3689        _ = builder.Property(outboxEntry => outboxEntry.LastErrorCode)
 3690            .HasMaxLength(ErrorCodeMaxLength);
 91
 3692        _ = builder.Property(outboxEntry => outboxEntry.LastErrorProviderName)
 3693            .HasMaxLength(ProviderMaxLength);
 94
 3695        _ = builder.Property(outboxEntry => outboxEntry.LastErrorProviderErrorCode)
 3696            .HasMaxLength(ProviderErrorCodeMaxLength);
 97
 3698        _ = builder.Property(outboxEntry => outboxEntry.MetadataJson)
 3699            .IsRequired();
 100
 36101        _ = builder.Property(outboxEntry => outboxEntry.ClaimOwner)
 36102            .HasMaxLength(IdentifierMaxLength);
 103
 36104        _ = builder.Property(outboxEntry => outboxEntry.ClaimToken)
 36105            .HasMaxLength(IdentifierMaxLength);
 106
 36107        _ = builder.Property(outboxEntry => outboxEntry.ClaimedUtc)
 36108            .HasConversion(NullableDateTimeOffsetToUtcTicksConverter);
 109
 36110        _ = builder.Property(outboxEntry => outboxEntry.ClaimExpiresUtc)
 36111            .HasConversion(NullableDateTimeOffsetToUtcTicksConverter);
 112
 36113        _ = builder.Property(outboxEntry => outboxEntry.ClaimAttemptCount)
 36114            .IsRequired();
 115
 36116        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeId)
 36117            .IsRequired()
 36118            .HasMaxLength(IdentifierMaxLength);
 119
 36120        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeSchemaVersion)
 36121            .IsRequired()
 36122            .HasMaxLength(SchemaVersionMaxLength);
 123
 36124        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeEventType)
 36125            .HasConversion<string>()
 36126            .IsRequired()
 36127            .HasMaxLength(StatusMaxLength);
 128
 36129        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeEventId)
 36130            .HasMaxLength(IdentifierMaxLength);
 131
 36132        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeOccurredUtc)
 36133            .HasConversion(DateTimeOffsetToUtcTicksConverter)
 36134            .IsRequired();
 135
 36136        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeCreatedUtc)
 36137            .HasConversion(DateTimeOffsetToUtcTicksConverter)
 36138            .IsRequired();
 139
 36140        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeCorrelationId)
 36141            .HasMaxLength(IdentifierMaxLength);
 142
 36143        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeAuditResidueId)
 36144            .HasMaxLength(IdentifierMaxLength);
 145
 36146        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeLifecycleStage)
 36147            .HasConversion<string>()
 36148            .HasMaxLength(StageMaxLength);
 149
 36150        _ = builder.Property(outboxEntry => outboxEntry.EnvelopePolicyVersion)
 36151            .HasMaxLength(PolicyVersionMaxLength);
 152
 36153        _ = builder.Property(outboxEntry => outboxEntry.EnvelopePolicyHash)
 36154            .HasMaxLength(HashMaxLength);
 155
 36156        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeTraceId)
 36157            .HasMaxLength(IdentifierMaxLength);
 158
 36159        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeSpanId)
 36160            .HasMaxLength(IdentifierMaxLength);
 161
 36162        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeParentSpanId)
 36163            .HasMaxLength(IdentifierMaxLength);
 164
 36165        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeOperationName)
 36166            .HasMaxLength(OperationNameMaxLength);
 167
 36168        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeOutcome)
 36169            .HasMaxLength(OutcomeMaxLength);
 170
 36171        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeActorId)
 36172            .HasMaxLength(IdentifierMaxLength);
 173
 36174        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeEmitterStatus)
 36175            .HasMaxLength(StatusMaxLength);
 176
 36177        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeEmitterProvider)
 36178            .HasMaxLength(ProviderMaxLength);
 179
 36180        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeGatewayExecutionId)
 36181            .HasMaxLength(IdentifierMaxLength);
 182
 36183        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeDecisionStage)
 36184            .HasMaxLength(StageMaxLength);
 185
 36186        _ = builder.Property(outboxEntry => outboxEntry.EnvelopeMetadataJson)
 36187            .IsRequired();
 188
 36189        _ = builder.Property(outboxEntry => outboxEntry.EnvelopePayloadType)
 36190            .HasMaxLength(PayloadTypeMaxLength);
 191
 36192        _ = builder.Property(outboxEntry => outboxEntry.EnvelopePayloadSchemaVersion)
 36193            .HasMaxLength(SchemaVersionMaxLength);
 194
 36195        _ = builder.Property(outboxEntry => outboxEntry.EnvelopePayloadContentType)
 36196            .HasMaxLength(ContentTypeMaxLength);
 197
 36198        _ = builder.Property(outboxEntry => outboxEntry.EnvelopePayloadContentHash)
 36199            .HasMaxLength(HashMaxLength);
 200
 36201        _ = builder.Property(outboxEntry => outboxEntry.EnvelopePayloadMetadataJson)
 36202            .IsRequired();
 203
 36204        _ = builder.HasIndex(outboxEntry => outboxEntry.OutboxEntryId)
 36205            .IsUnique();
 206
 36207        _ = builder.HasIndex(outboxEntry => outboxEntry.Status);
 208
 36209        _ = builder.HasIndex(outboxEntry => outboxEntry.NextRetryUtc);
 210
 36211        _ = builder.HasIndex(outboxEntry => outboxEntry.CreatedUtc);
 212
 36213        _ = builder.HasIndex(outboxEntry => outboxEntry.UpdatedUtc);
 214
 36215        _ = builder.HasIndex(outboxEntry => outboxEntry.DeliveredUtc);
 216
 36217        _ = builder.HasIndex(outboxEntry => outboxEntry.ProviderName);
 218
 36219        _ = builder.HasIndex(outboxEntry => outboxEntry.ProviderRecordId);
 220
 36221        _ = builder.HasIndex(outboxEntry => outboxEntry.LastErrorCode);
 222
 36223        _ = builder.HasIndex(outboxEntry => outboxEntry.ClaimOwner);
 224
 36225        _ = builder.HasIndex(outboxEntry => outboxEntry.ClaimToken);
 226
 36227        _ = builder.HasIndex(outboxEntry => outboxEntry.ClaimExpiresUtc);
 228
 36229        _ = builder.HasIndex(outboxEntry => outboxEntry.EnvelopeId);
 230
 36231        _ = builder.HasIndex(outboxEntry => outboxEntry.EnvelopeEventId);
 232
 36233        _ = builder.HasIndex(outboxEntry => outboxEntry.EnvelopeCorrelationId);
 234
 36235        _ = builder.HasIndex(outboxEntry => outboxEntry.EnvelopeAuditResidueId);
 236
 36237        _ = builder.HasIndex(outboxEntry => outboxEntry.EnvelopePolicyVersion);
 238
 36239        _ = builder.HasIndex(outboxEntry => outboxEntry.EnvelopePolicyHash);
 240
 36241        _ = builder.HasIndex(outboxEntry => outboxEntry.EnvelopeTraceId);
 242
 36243        _ = builder.HasIndex(outboxEntry => outboxEntry.EnvelopeOutboxSequence);
 244
 36245        _ = builder.HasIndex(outboxEntry => new
 36246        {
 36247            outboxEntry.Status,
 36248            outboxEntry.ClaimExpiresUtc,
 36249            outboxEntry.CreatedUtc,
 36250            outboxEntry.OutboxEntryId
 36251        });
 252
 36253        _ = builder.HasIndex(outboxEntry => new
 36254        {
 36255            outboxEntry.Status,
 36256            outboxEntry.ClaimExpiresUtc,
 36257            outboxEntry.NextRetryUtc,
 36258            outboxEntry.UpdatedUtc,
 36259            outboxEntry.OutboxEntryId
 36260        });
 261
 36262        _ = builder.HasIndex(outboxEntry => new
 36263        {
 36264            outboxEntry.Status,
 36265            outboxEntry.NextRetryUtc,
 36266            outboxEntry.UpdatedUtc,
 36267            outboxEntry.OutboxEntryId
 36268        });
 269
 36270        _ = builder.HasIndex(outboxEntry => new
 36271        {
 36272            outboxEntry.Status,
 36273            outboxEntry.CreatedUtc,
 36274            outboxEntry.OutboxEntryId
 36275        });
 276
 36277        _ = builder.HasIndex(outboxEntry => new
 36278        {
 36279            outboxEntry.EnvelopeCorrelationId,
 36280            outboxEntry.CreatedUtc
 36281        });
 282
 36283        _ = builder.HasIndex(outboxEntry => new
 36284        {
 36285            outboxEntry.EnvelopeAuditResidueId,
 36286            outboxEntry.CreatedUtc
 36287        });
 36288    }
 289}