< Summary

Information
Class: AsiBackbone.EntityFrameworkCore.Configurations.AsiBackboneAuditLedgerRecordEntityConfiguration
Assembly: AsiBackbone.EntityFrameworkCore
File(s): /home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.EntityFrameworkCore/Configurations/AsiBackboneAuditLedgerRecordEntityConfiguration.cs
Line coverage
100%
Covered lines: 125
Uncovered lines: 0
Coverable lines: 125
Total lines: 226
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
Configure(...)100%11100%

File(s)

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

#LineLine coverage
 1using AsiBackbone.EntityFrameworkCore.Persistence;
 2using Microsoft.EntityFrameworkCore;
 3using Microsoft.EntityFrameworkCore.Metadata.Builders;
 4
 5namespace AsiBackbone.EntityFrameworkCore.Configurations;
 6
 7/// <summary>
 8/// Configures the Entity Framework Core persistence mapping for <see cref="AsiBackboneAuditLedgerRecordEntity" />.
 9/// </summary>
 10public sealed class AsiBackboneAuditLedgerRecordEntityConfiguration
 11    : IEntityTypeConfiguration<AsiBackboneAuditLedgerRecordEntity>
 12{
 13    private const int IdentifierMaxLength = 128;
 14    private const int SchemaVersionMaxLength = 64;
 15    private const int DisplayNameMaxLength = 256;
 16    private const int OperationNameMaxLength = 256;
 17    private const int OutcomeMaxLength = 128;
 18    private const int ActorTypeMaxLength = 64;
 19    private const int CorrelationMaxLength = 128;
 20    private const int PolicyVersionMaxLength = 128;
 21    private const int PolicyScopeMaxLength = 256;
 22    private const int StatusMaxLength = 128;
 23    private const int ProviderMaxLength = 128;
 24    private const int StageMaxLength = 128;
 25    private const int HashMaxLength = 512;
 26    private const int SignatureKeyIdMaxLength = 128;
 27    private const int SignatureAlgorithmMaxLength = 128;
 28    private const int ConcurrencyStampMaxLength = 64;
 29
 30    /// <inheritdoc />
 31    public void Configure(EntityTypeBuilder<AsiBackboneAuditLedgerRecordEntity> builder)
 32    {
 2233        ArgumentNullException.ThrowIfNull(builder);
 34
 2235        _ = builder.ToTable("AsiBackboneAuditLedgerRecords");
 36
 2237        _ = builder.HasKey(record => record.Id);
 38
 2239        _ = builder.Property(record => record.Id)
 2240            .ValueGeneratedNever();
 41
 2242        _ = builder.Property(record => record.ConcurrencyStamp)
 2243            .IsRequired()
 2244            .HasMaxLength(ConcurrencyStampMaxLength)
 2245            .IsConcurrencyToken();
 46
 2247        _ = builder.Property(record => record.RecordId)
 2248            .IsRequired()
 2249            .HasMaxLength(IdentifierMaxLength);
 50
 2251        _ = builder.Property(record => record.SchemaVersion)
 2252            .IsRequired()
 2253            .HasMaxLength(SchemaVersionMaxLength);
 54
 2255        _ = builder.Property(record => record.EventId)
 2256            .IsRequired()
 2257            .HasMaxLength(IdentifierMaxLength);
 58
 2259        _ = builder.Property(record => record.AuditResidueId)
 2260            .HasMaxLength(IdentifierMaxLength);
 61
 2262        _ = builder.Property(record => record.OccurredUtc)
 2263            .IsRequired();
 64
 2265        _ = builder.Property(record => record.RecordedUtc)
 2266            .IsRequired();
 67
 2268        _ = builder.Property(record => record.ActorId)
 2269            .IsRequired()
 2270            .HasMaxLength(IdentifierMaxLength);
 71
 2272        _ = builder.Property(record => record.ActorType)
 2273            .HasConversion<string>()
 2274            .IsRequired()
 2275            .HasMaxLength(ActorTypeMaxLength);
 76
 2277        _ = builder.Property(record => record.ActorDisplayName)
 2278            .HasMaxLength(DisplayNameMaxLength);
 79
 2280        _ = builder.Property(record => record.OperationName)
 2281            .IsRequired()
 2282            .HasMaxLength(OperationNameMaxLength);
 83
 2284        _ = builder.Property(record => record.Outcome)
 2285            .IsRequired()
 2286            .HasMaxLength(OutcomeMaxLength);
 87
 2288        _ = builder.Property(record => record.ReasonCodesJson)
 2289            .IsRequired();
 90
 2291        _ = builder.Property(record => record.CorrelationId)
 2292            .HasMaxLength(CorrelationMaxLength);
 93
 2294        _ = builder.Property(record => record.TraceId)
 2295            .HasMaxLength(CorrelationMaxLength);
 96
 2297        _ = builder.Property(record => record.SpanId)
 2298            .HasMaxLength(CorrelationMaxLength);
 99
 22100        _ = builder.Property(record => record.ParentSpanId)
 22101            .HasMaxLength(CorrelationMaxLength);
 102
 22103        _ = builder.Property(record => record.ConstraintSetHash)
 22104            .HasMaxLength(HashMaxLength);
 105
 22106        _ = builder.Property(record => record.PolicyScope)
 22107            .HasMaxLength(PolicyScopeMaxLength);
 108
 22109        _ = builder.Property(record => record.TenantHash)
 22110            .HasMaxLength(HashMaxLength);
 111
 22112        _ = builder.Property(record => record.OrganizationHash)
 22113            .HasMaxLength(HashMaxLength);
 114
 22115        _ = builder.Property(record => record.EmitterStatus)
 22116            .HasMaxLength(StatusMaxLength);
 117
 22118        _ = builder.Property(record => record.EmitterProvider)
 22119            .HasMaxLength(ProviderMaxLength);
 120
 22121        _ = builder.Property(record => record.GatewayExecutionId)
 22122            .HasMaxLength(IdentifierMaxLength);
 123
 22124        _ = builder.Property(record => record.DecisionStage)
 22125            .HasMaxLength(StageMaxLength);
 126
 22127        _ = builder.Property(record => record.PolicyVersion)
 22128            .HasMaxLength(PolicyVersionMaxLength);
 129
 22130        _ = builder.Property(record => record.PolicyHash)
 22131            .HasMaxLength(HashMaxLength);
 132
 22133        _ = builder.Property(record => record.HandshakeId)
 22134            .HasMaxLength(IdentifierMaxLength);
 135
 22136        _ = builder.Property(record => record.AcknowledgmentId)
 22137            .HasMaxLength(IdentifierMaxLength);
 138
 22139        _ = builder.Property(record => record.CapabilityTokenId)
 22140            .HasMaxLength(IdentifierMaxLength);
 141
 22142        _ = builder.Property(record => record.PreviousRecordHash)
 22143            .HasMaxLength(HashMaxLength);
 144
 22145        _ = builder.Property(record => record.RecordHash)
 22146            .HasMaxLength(HashMaxLength);
 147
 22148        _ = builder.Property(record => record.SignatureKeyId)
 22149            .HasMaxLength(SignatureKeyIdMaxLength);
 150
 22151        _ = builder.Property(record => record.SignatureAlgorithm)
 22152            .HasMaxLength(SignatureAlgorithmMaxLength);
 153
 22154        _ = builder.Property(record => record.SignatureValue);
 155
 22156        _ = builder.Property(record => record.MetadataJson)
 22157            .IsRequired();
 158
 22159        _ = builder.HasIndex(record => record.RecordId)
 22160            .IsUnique();
 161
 22162        _ = builder.HasIndex(record => record.SchemaVersion);
 163
 22164        _ = builder.HasIndex(record => record.EventId);
 165
 22166        _ = builder.HasIndex(record => record.AuditResidueId);
 167
 22168        _ = builder.HasIndex(record => record.OccurredUtc);
 169
 22170        _ = builder.HasIndex(record => record.RecordedUtc);
 171
 22172        _ = builder.HasIndex(record => record.ActorId);
 173
 22174        _ = builder.HasIndex(record => record.ActorType);
 175
 22176        _ = builder.HasIndex(record => record.OperationName);
 177
 22178        _ = builder.HasIndex(record => record.Outcome);
 179
 22180        _ = builder.HasIndex(record => record.CorrelationId);
 181
 22182        _ = builder.HasIndex(record => record.TraceId);
 183
 22184        _ = builder.HasIndex(record => record.SpanId);
 185
 22186        _ = builder.HasIndex(record => record.PolicyVersion);
 187
 22188        _ = builder.HasIndex(record => record.PolicyHash);
 189
 22190        _ = builder.HasIndex(record => record.PolicyScope);
 191
 22192        _ = builder.HasIndex(record => record.TenantHash);
 193
 22194        _ = builder.HasIndex(record => record.OrganizationHash);
 195
 22196        _ = builder.HasIndex(record => record.EmitterStatus);
 197
 22198        _ = builder.HasIndex(record => record.EmitterProvider);
 199
 22200        _ = builder.HasIndex(record => record.OutboxSequence);
 201
 22202        _ = builder.HasIndex(record => record.GatewayExecutionId);
 203
 22204        _ = builder.HasIndex(record => record.DecisionStage);
 205
 22206        _ = builder.HasIndex(record => record.HandshakeId);
 207
 22208        _ = builder.HasIndex(record => record.AcknowledgmentId);
 209
 22210        _ = builder.HasIndex(record => record.CapabilityTokenId);
 211
 22212        _ = builder.HasIndex(record => record.RecordHash);
 213
 22214        _ = builder.HasIndex(record => new
 22215        {
 22216            record.ActorId,
 22217            record.RecordedUtc
 22218        });
 219
 22220        _ = builder.HasIndex(record => new
 22221        {
 22222            record.CorrelationId,
 22223            record.RecordedUtc
 22224        });
 22225    }
 226}