< 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: 137
Uncovered lines: 0
Coverable lines: 137
Total lines: 249
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 SignatureKeyVersionMaxLength = 128;
 28    private const int SignatureAlgorithmMaxLength = 128;
 29    private const int SignatureProviderMaxLength = 128;
 30    private const int ConcurrencyStampMaxLength = 64;
 31
 32    /// <inheritdoc />
 33    public void Configure(EntityTypeBuilder<AsiBackboneAuditLedgerRecordEntity> builder)
 34    {
 3635        ArgumentNullException.ThrowIfNull(builder);
 36
 3637        _ = builder.ToTable("AsiBackboneAuditLedgerRecords");
 38
 3639        _ = builder.HasKey(record => record.Id);
 40
 3641        _ = builder.Property(record => record.Id)
 3642            .ValueGeneratedNever();
 43
 3644        _ = builder.Property(record => record.ConcurrencyStamp)
 3645            .IsRequired()
 3646            .HasMaxLength(ConcurrencyStampMaxLength)
 3647            .IsConcurrencyToken();
 48
 3649        _ = builder.Property(record => record.RecordId)
 3650            .IsRequired()
 3651            .HasMaxLength(IdentifierMaxLength);
 52
 3653        _ = builder.Property(record => record.SchemaVersion)
 3654            .IsRequired()
 3655            .HasMaxLength(SchemaVersionMaxLength);
 56
 3657        _ = builder.Property(record => record.EventId)
 3658            .IsRequired()
 3659            .HasMaxLength(IdentifierMaxLength);
 60
 3661        _ = builder.Property(record => record.AuditResidueId)
 3662            .HasMaxLength(IdentifierMaxLength);
 63
 3664        _ = builder.Property(record => record.OccurredUtc)
 3665            .IsRequired();
 66
 3667        _ = builder.Property(record => record.RecordedUtc)
 3668            .IsRequired();
 69
 3670        _ = builder.Property(record => record.ActorId)
 3671            .IsRequired()
 3672            .HasMaxLength(IdentifierMaxLength);
 73
 3674        _ = builder.Property(record => record.ActorType)
 3675            .HasConversion<string>()
 3676            .IsRequired()
 3677            .HasMaxLength(ActorTypeMaxLength);
 78
 3679        _ = builder.Property(record => record.ActorDisplayName)
 3680            .HasMaxLength(DisplayNameMaxLength);
 81
 3682        _ = builder.Property(record => record.OperationName)
 3683            .IsRequired()
 3684            .HasMaxLength(OperationNameMaxLength);
 85
 3686        _ = builder.Property(record => record.Outcome)
 3687            .IsRequired()
 3688            .HasMaxLength(OutcomeMaxLength);
 89
 3690        _ = builder.Property(record => record.ReasonCodesJson)
 3691            .IsRequired();
 92
 3693        _ = builder.Property(record => record.CorrelationId)
 3694            .HasMaxLength(CorrelationMaxLength);
 95
 3696        _ = builder.Property(record => record.TraceId)
 3697            .HasMaxLength(CorrelationMaxLength);
 98
 3699        _ = builder.Property(record => record.SpanId)
 36100            .HasMaxLength(CorrelationMaxLength);
 101
 36102        _ = builder.Property(record => record.ParentSpanId)
 36103            .HasMaxLength(CorrelationMaxLength);
 104
 36105        _ = builder.Property(record => record.ConstraintSetHash)
 36106            .HasMaxLength(HashMaxLength);
 107
 36108        _ = builder.Property(record => record.PolicyScope)
 36109            .HasMaxLength(PolicyScopeMaxLength);
 110
 36111        _ = builder.Property(record => record.TenantHash)
 36112            .HasMaxLength(HashMaxLength);
 113
 36114        _ = builder.Property(record => record.OrganizationHash)
 36115            .HasMaxLength(HashMaxLength);
 116
 36117        _ = builder.Property(record => record.EmitterStatus)
 36118            .HasMaxLength(StatusMaxLength);
 119
 36120        _ = builder.Property(record => record.EmitterProvider)
 36121            .HasMaxLength(ProviderMaxLength);
 122
 36123        _ = builder.Property(record => record.GatewayExecutionId)
 36124            .HasMaxLength(IdentifierMaxLength);
 125
 36126        _ = builder.Property(record => record.DecisionStage)
 36127            .HasMaxLength(StageMaxLength);
 128
 36129        _ = builder.Property(record => record.PolicyVersion)
 36130            .HasMaxLength(PolicyVersionMaxLength);
 131
 36132        _ = builder.Property(record => record.PolicyHash)
 36133            .HasMaxLength(HashMaxLength);
 134
 36135        _ = builder.Property(record => record.HandshakeId)
 36136            .HasMaxLength(IdentifierMaxLength);
 137
 36138        _ = builder.Property(record => record.AcknowledgmentId)
 36139            .HasMaxLength(IdentifierMaxLength);
 140
 36141        _ = builder.Property(record => record.CapabilityTokenId)
 36142            .HasMaxLength(IdentifierMaxLength);
 143
 36144        _ = builder.Property(record => record.PreviousRecordHash)
 36145            .HasMaxLength(HashMaxLength);
 146
 36147        _ = builder.Property(record => record.RecordHash)
 36148            .HasMaxLength(HashMaxLength);
 149
 36150        _ = builder.Property(record => record.SigningHash)
 36151            .HasMaxLength(HashMaxLength);
 152
 36153        _ = builder.Property(record => record.SignatureKeyId)
 36154            .HasMaxLength(SignatureKeyIdMaxLength);
 155
 36156        _ = builder.Property(record => record.SignatureKeyVersion)
 36157            .HasMaxLength(SignatureKeyVersionMaxLength);
 158
 36159        _ = builder.Property(record => record.SignatureAlgorithm)
 36160            .HasMaxLength(SignatureAlgorithmMaxLength);
 161
 36162        _ = builder.Property(record => record.SignatureValue);
 163
 36164        _ = builder.Property(record => record.SignatureProvider)
 36165            .HasMaxLength(SignatureProviderMaxLength);
 166
 36167        _ = builder.Property(record => record.SignedUtc);
 168
 36169        _ = builder.Property(record => record.MetadataJson)
 36170            .IsRequired();
 171
 36172        _ = builder.HasIndex(record => record.RecordId)
 36173            .IsUnique();
 174
 36175        _ = builder.HasIndex(record => record.SchemaVersion);
 176
 36177        _ = builder.HasIndex(record => record.EventId);
 178
 36179        _ = builder.HasIndex(record => record.AuditResidueId);
 180
 36181        _ = builder.HasIndex(record => record.OccurredUtc);
 182
 36183        _ = builder.HasIndex(record => record.RecordedUtc);
 184
 36185        _ = builder.HasIndex(record => record.ActorId);
 186
 36187        _ = builder.HasIndex(record => record.ActorType);
 188
 36189        _ = builder.HasIndex(record => record.OperationName);
 190
 36191        _ = builder.HasIndex(record => record.Outcome);
 192
 36193        _ = builder.HasIndex(record => record.CorrelationId);
 194
 36195        _ = builder.HasIndex(record => record.TraceId);
 196
 36197        _ = builder.HasIndex(record => record.SpanId);
 198
 36199        _ = builder.HasIndex(record => record.PolicyVersion);
 200
 36201        _ = builder.HasIndex(record => record.PolicyHash);
 202
 36203        _ = builder.HasIndex(record => record.PolicyScope);
 204
 36205        _ = builder.HasIndex(record => record.TenantHash);
 206
 36207        _ = builder.HasIndex(record => record.OrganizationHash);
 208
 36209        _ = builder.HasIndex(record => record.EmitterStatus);
 210
 36211        _ = builder.HasIndex(record => record.EmitterProvider);
 212
 36213        _ = builder.HasIndex(record => record.OutboxSequence);
 214
 36215        _ = builder.HasIndex(record => record.GatewayExecutionId);
 216
 36217        _ = builder.HasIndex(record => record.DecisionStage);
 218
 36219        _ = builder.HasIndex(record => record.HandshakeId);
 220
 36221        _ = builder.HasIndex(record => record.AcknowledgmentId);
 222
 36223        _ = builder.HasIndex(record => record.CapabilityTokenId);
 224
 36225        _ = builder.HasIndex(record => record.RecordHash);
 226
 36227        _ = builder.HasIndex(record => record.SigningHash);
 228
 36229        _ = builder.HasIndex(record => record.SignatureKeyId);
 230
 36231        _ = builder.HasIndex(record => record.SignatureKeyVersion);
 232
 36233        _ = builder.HasIndex(record => record.SignatureProvider);
 234
 36235        _ = builder.HasIndex(record => record.SignedUtc);
 236
 36237        _ = builder.HasIndex(record => new
 36238        {
 36239            record.ActorId,
 36240            record.RecordedUtc
 36241        });
 242
 36243        _ = builder.HasIndex(record => new
 36244        {
 36245            record.CorrelationId,
 36246            record.RecordedUtc
 36247        });
 36248    }
 249}