< 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    {
 2037        ArgumentNullException.ThrowIfNull(builder);
 38
 2039        _ = builder.ToTable("AsiBackboneAuditLedgerRecords");
 40
 2041        _ = builder.HasKey(record => record.Id);
 42
 2043        _ = builder.Property(record => record.Id)
 2044            .ValueGeneratedNever();
 45
 2046        _ = builder.Property(record => record.ConcurrencyStamp)
 2047            .IsRequired()
 2048            .HasMaxLength(ConcurrencyStampMaxLength)
 2049            .IsConcurrencyToken();
 50
 2051        _ = builder.Property(record => record.RecordId)
 2052            .IsRequired()
 2053            .HasMaxLength(IdentifierMaxLength);
 54
 2055        _ = builder.Property(record => record.SchemaVersion)
 2056            .IsRequired()
 2057            .HasMaxLength(SchemaVersionMaxLength);
 58
 2059        _ = builder.Property(record => record.EventId)
 2060            .IsRequired()
 2061            .HasMaxLength(IdentifierMaxLength);
 62
 2063        _ = builder.Property(record => record.DecisionReceiptId)
 2064            .HasMaxLength(IdentifierMaxLength);
 65
 2066        _ = builder.Property(record => record.OccurredUtc)
 2067            .IsRequired();
 68
 2069        _ = builder.Property(record => record.RecordedUtc)
 2070            .IsRequired();
 71
 2072        _ = builder.Property(record => record.ActorId)
 2073            .IsRequired()
 2074            .HasMaxLength(IdentifierMaxLength);
 75
 2076        _ = builder.Property(record => record.ActorType)
 2077            .HasConversion<string>()
 2078            .IsRequired()
 2079            .HasMaxLength(ActorTypeMaxLength);
 80
 2081        _ = builder.Property(record => record.ActorDisplayName)
 2082            .HasMaxLength(DisplayNameMaxLength);
 83
 2084        _ = builder.Property(record => record.OperationName)
 2085            .IsRequired()
 2086            .HasMaxLength(OperationNameMaxLength);
 87
 2088        _ = builder.Property(record => record.Outcome)
 2089            .IsRequired()
 2090            .HasMaxLength(OutcomeMaxLength);
 91
 2092        _ = builder.Property(record => record.ReasonCodesJson)
 2093            .IsRequired()
 2094            .HasMaxLength(SerializedJsonMaxLength);
 95
 2096        _ = builder.Property(record => record.CorrelationId)
 2097            .HasMaxLength(CorrelationMaxLength);
 98
 2099        _ = builder.Property(record => record.TraceId)
 20100            .HasMaxLength(CorrelationMaxLength);
 101
 20102        _ = builder.Property(record => record.SpanId)
 20103            .HasMaxLength(CorrelationMaxLength);
 104
 20105        _ = builder.Property(record => record.ParentSpanId)
 20106            .HasMaxLength(CorrelationMaxLength);
 107
 20108        _ = builder.Property(record => record.ConstraintSetHash)
 20109            .HasMaxLength(HashMaxLength);
 110
 20111        _ = builder.Property(record => record.PolicyScope)
 20112            .HasMaxLength(PolicyScopeMaxLength);
 113
 20114        _ = builder.Property(record => record.TenantHash)
 20115            .HasMaxLength(HashMaxLength);
 116
 20117        _ = builder.Property(record => record.OrganizationHash)
 20118            .HasMaxLength(HashMaxLength);
 119
 20120        _ = builder.Property(record => record.EmitterStatus)
 20121            .HasMaxLength(StatusMaxLength);
 122
 20123        _ = builder.Property(record => record.EmitterProvider)
 20124            .HasMaxLength(ProviderMaxLength);
 125
 20126        _ = builder.Property(record => record.GatewayExecutionId)
 20127            .HasMaxLength(IdentifierMaxLength);
 128
 20129        _ = builder.Property(record => record.DecisionStage)
 20130            .HasMaxLength(StageMaxLength);
 131
 20132        _ = builder.Property(record => record.PolicyVersion)
 20133            .HasMaxLength(PolicyVersionMaxLength);
 134
 20135        _ = builder.Property(record => record.PolicyHash)
 20136            .HasMaxLength(HashMaxLength);
 137
 20138        _ = builder.Property(record => record.HandshakeId)
 20139            .HasMaxLength(IdentifierMaxLength);
 140
 20141        _ = builder.Property(record => record.AcknowledgmentId)
 20142            .HasMaxLength(IdentifierMaxLength);
 143
 20144        _ = builder.Property(record => record.CapabilityTokenId)
 20145            .HasMaxLength(IdentifierMaxLength);
 146
 20147        _ = builder.Property(record => record.PreviousRecordHash)
 20148            .HasMaxLength(HashMaxLength);
 149
 20150        _ = builder.Property(record => record.RecordHash)
 20151            .HasMaxLength(HashMaxLength);
 152
 20153        _ = builder.Property(record => record.SigningHash)
 20154            .HasMaxLength(HashMaxLength);
 155
 20156        _ = builder.Property(record => record.SignatureKeyId)
 20157            .HasMaxLength(SignatureKeyIdMaxLength);
 158
 20159        _ = builder.Property(record => record.SignatureKeyVersion)
 20160            .HasMaxLength(SignatureKeyVersionMaxLength);
 161
 20162        _ = builder.Property(record => record.SignatureAlgorithm)
 20163            .HasMaxLength(SignatureAlgorithmMaxLength);
 164
 20165        _ = builder.Property(record => record.SignatureValue)
 20166            .HasMaxLength(SignatureValueMaxLength);
 167
 20168        _ = builder.Property(record => record.SignatureProvider)
 20169            .HasMaxLength(SignatureProviderMaxLength);
 170
 20171        _ = builder.Property(record => record.SignedUtc);
 172
 20173        _ = builder.Property(record => record.MetadataJson)
 20174            .IsRequired()
 20175            .HasMaxLength(SerializedJsonMaxLength);
 176
 20177        _ = builder.HasIndex(record => record.RecordId)
 20178            .IsUnique();
 179
 20180        _ = builder.HasIndex(record => new
 20181        {
 20182            record.RecordedUtc,
 20183            record.RecordId
 20184        });
 185
 20186        _ = builder.HasIndex(record => new
 20187        {
 20188            record.ActorId,
 20189            record.RecordedUtc,
 20190            record.RecordId
 20191        });
 192
 20193        _ = builder.HasIndex(record => new
 20194        {
 20195            record.CorrelationId,
 20196            record.RecordedUtc,
 20197            record.RecordId
 20198        });
 199
 20200        _ = builder.HasIndex(record => new
 20201        {
 20202            record.TraceId,
 20203            record.RecordedUtc,
 20204            record.RecordId
 20205        });
 206
 20207        _ = builder.HasIndex(record => record.PreviousRecordHash);
 20208    }
 209}