< Summary

Information
Class: AsiBackbone.EntityFrameworkCore.Configurations.AuditLedgerRecordEntityConfiguration
Assembly: AsiBackbone.EntityFrameworkCore
File(s): /home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.EntityFrameworkCore/Configurations/AuditLedgerRecordEntityConfiguration.cs
Line coverage
100%
Covered lines: 123
Uncovered lines: 0
Coverable lines: 123
Total lines: 209
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/AuditLedgerRecordEntityConfiguration.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="AuditLedgerRecordEntity" />.
 9/// </summary>
 10public sealed class AuditLedgerRecordEntityConfiguration
 11    : IEntityTypeConfiguration<AuditLedgerRecordEntity>
 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 SignatureKeyVersionMaxLength = 128;
 28    private const int SignatureAlgorithmMaxLength = 128;
 29    private const int SignatureProviderMaxLength = 128;
 30    private const int SignatureValueMaxLength = 16384;
 31    private const int SerializedJsonMaxLength = 65536;
 32    private const int ConcurrencyStampMaxLength = 64;
 33
 34    /// <inheritdoc />
 35    public void Configure(EntityTypeBuilder<AuditLedgerRecordEntity> builder)
 36    {
 1937        ArgumentNullException.ThrowIfNull(builder);
 38
 1939        _ = builder.ToTable("AsiBackboneAuditLedgerRecords");
 40
 1941        _ = builder.HasKey(record => record.Id);
 42
 1943        _ = builder.Property(record => record.Id)
 1944            .ValueGeneratedNever();
 45
 1946        _ = builder.Property(record => record.ConcurrencyStamp)
 1947            .IsRequired()
 1948            .HasMaxLength(ConcurrencyStampMaxLength)
 1949            .IsConcurrencyToken();
 50
 1951        _ = builder.Property(record => record.RecordId)
 1952            .IsRequired()
 1953            .HasMaxLength(IdentifierMaxLength);
 54
 1955        _ = builder.Property(record => record.SchemaVersion)
 1956            .IsRequired()
 1957            .HasMaxLength(SchemaVersionMaxLength);
 58
 1959        _ = builder.Property(record => record.EventId)
 1960            .IsRequired()
 1961            .HasMaxLength(IdentifierMaxLength);
 62
 1963        _ = builder.Property(record => record.DecisionReceiptId)
 1964            .HasMaxLength(IdentifierMaxLength);
 65
 1966        _ = builder.Property(record => record.OccurredUtc)
 1967            .IsRequired();
 68
 1969        _ = builder.Property(record => record.RecordedUtc)
 1970            .IsRequired();
 71
 1972        _ = builder.Property(record => record.ActorId)
 1973            .IsRequired()
 1974            .HasMaxLength(IdentifierMaxLength);
 75
 1976        _ = builder.Property(record => record.ActorType)
 1977            .HasConversion<string>()
 1978            .IsRequired()
 1979            .HasMaxLength(ActorTypeMaxLength);
 80
 1981        _ = builder.Property(record => record.ActorDisplayName)
 1982            .HasMaxLength(DisplayNameMaxLength);
 83
 1984        _ = builder.Property(record => record.OperationName)
 1985            .IsRequired()
 1986            .HasMaxLength(OperationNameMaxLength);
 87
 1988        _ = builder.Property(record => record.Outcome)
 1989            .IsRequired()
 1990            .HasMaxLength(OutcomeMaxLength);
 91
 1992        _ = builder.Property(record => record.ReasonCodesJson)
 1993            .IsRequired()
 1994            .HasMaxLength(SerializedJsonMaxLength);
 95
 1996        _ = builder.Property(record => record.CorrelationId)
 1997            .HasMaxLength(CorrelationMaxLength);
 98
 1999        _ = builder.Property(record => record.TraceId)
 19100            .HasMaxLength(CorrelationMaxLength);
 101
 19102        _ = builder.Property(record => record.SpanId)
 19103            .HasMaxLength(CorrelationMaxLength);
 104
 19105        _ = builder.Property(record => record.ParentSpanId)
 19106            .HasMaxLength(CorrelationMaxLength);
 107
 19108        _ = builder.Property(record => record.ConstraintSetHash)
 19109            .HasMaxLength(HashMaxLength);
 110
 19111        _ = builder.Property(record => record.PolicyScope)
 19112            .HasMaxLength(PolicyScopeMaxLength);
 113
 19114        _ = builder.Property(record => record.TenantHash)
 19115            .HasMaxLength(HashMaxLength);
 116
 19117        _ = builder.Property(record => record.OrganizationHash)
 19118            .HasMaxLength(HashMaxLength);
 119
 19120        _ = builder.Property(record => record.EmitterStatus)
 19121            .HasMaxLength(StatusMaxLength);
 122
 19123        _ = builder.Property(record => record.EmitterProvider)
 19124            .HasMaxLength(ProviderMaxLength);
 125
 19126        _ = builder.Property(record => record.GatewayExecutionId)
 19127            .HasMaxLength(IdentifierMaxLength);
 128
 19129        _ = builder.Property(record => record.DecisionStage)
 19130            .HasMaxLength(StageMaxLength);
 131
 19132        _ = builder.Property(record => record.PolicyVersion)
 19133            .HasMaxLength(PolicyVersionMaxLength);
 134
 19135        _ = builder.Property(record => record.PolicyHash)
 19136            .HasMaxLength(HashMaxLength);
 137
 19138        _ = builder.Property(record => record.HandshakeId)
 19139            .HasMaxLength(IdentifierMaxLength);
 140
 19141        _ = builder.Property(record => record.AcknowledgmentId)
 19142            .HasMaxLength(IdentifierMaxLength);
 143
 19144        _ = builder.Property(record => record.CapabilityTokenId)
 19145            .HasMaxLength(IdentifierMaxLength);
 146
 19147        _ = builder.Property(record => record.PreviousRecordHash)
 19148            .HasMaxLength(HashMaxLength);
 149
 19150        _ = builder.Property(record => record.RecordHash)
 19151            .HasMaxLength(HashMaxLength);
 152
 19153        _ = builder.Property(record => record.SigningHash)
 19154            .HasMaxLength(HashMaxLength);
 155
 19156        _ = builder.Property(record => record.SignatureKeyId)
 19157            .HasMaxLength(SignatureKeyIdMaxLength);
 158
 19159        _ = builder.Property(record => record.SignatureKeyVersion)
 19160            .HasMaxLength(SignatureKeyVersionMaxLength);
 161
 19162        _ = builder.Property(record => record.SignatureAlgorithm)
 19163            .HasMaxLength(SignatureAlgorithmMaxLength);
 164
 19165        _ = builder.Property(record => record.SignatureValue)
 19166            .HasMaxLength(SignatureValueMaxLength);
 167
 19168        _ = builder.Property(record => record.SignatureProvider)
 19169            .HasMaxLength(SignatureProviderMaxLength);
 170
 19171        _ = builder.Property(record => record.SignedUtc);
 172
 19173        _ = builder.Property(record => record.MetadataJson)
 19174            .IsRequired()
 19175            .HasMaxLength(SerializedJsonMaxLength);
 176
 19177        _ = builder.HasIndex(record => record.RecordId)
 19178            .IsUnique();
 179
 19180        _ = builder.HasIndex(record => new
 19181        {
 19182            record.RecordedUtc,
 19183            record.RecordId
 19184        });
 185
 19186        _ = builder.HasIndex(record => new
 19187        {
 19188            record.ActorId,
 19189            record.RecordedUtc,
 19190            record.RecordId
 19191        });
 192
 19193        _ = builder.HasIndex(record => new
 19194        {
 19195            record.CorrelationId,
 19196            record.RecordedUtc,
 19197            record.RecordId
 19198        });
 199
 19200        _ = builder.HasIndex(record => new
 19201        {
 19202            record.TraceId,
 19203            record.RecordedUtc,
 19204            record.RecordId
 19205        });
 206
 19207        _ = builder.HasIndex(record => record.PreviousRecordHash);
 19208    }
 209}