< Summary

Information
Class: Elsa.Persistence.EFCore.Modules.Labels.Configurations
Assembly: Elsa.Persistence.EFCore
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.EFCore/Modules/Labels/Configurations.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 30
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%
Configure(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Persistence.EFCore/Modules/Labels/Configurations.cs

#LineLine coverage
 1using Elsa.Labels.Entities;
 2using Microsoft.EntityFrameworkCore;
 3using Microsoft.EntityFrameworkCore.Metadata.Builders;
 4
 5namespace Elsa.Persistence.EFCore.Modules.Labels;
 6
 7public class Configurations : IEntityTypeConfiguration<Label>, IEntityTypeConfiguration<WorkflowDefinitionLabel>
 8{
 9    public void Configure(EntityTypeBuilder<Label> builder)
 10    {
 411        builder.Property(x => x.Name).HasMaxLength(Label.NameMaxLength).IsRequired();
 412        builder.Property(x => x.NormalizedName).HasMaxLength(Label.NameMaxLength).IsRequired();
 13
 14        // Uniqueness is per tenant, matching Secrets (and User, Role, Application).
 15        // A global unique index would make the name a shared resource across tenants.
 16        // SQL Server/Oracle still emit a filtered unique index (TenantId IS NOT NULL).
 17        // Default-tenant rows use "" — migrations stamp leftover null TenantId to "" first.
 418        builder.HasIndex(x => new { x.TenantId, x.NormalizedName })
 419            .HasDatabaseName($"IX_{nameof(Label)}_{nameof(Label.TenantId)}_{nameof(Label.NormalizedName)}")
 420            .IsUnique();
 421    }
 22
 23    public void Configure(EntityTypeBuilder<WorkflowDefinitionLabel> builder)
 24    {
 225        builder.HasIndex(x => x.WorkflowDefinitionId).HasDatabaseName($"{nameof(WorkflowDefinitionLabel)}_{nameof(Workfl
 226        builder.HasIndex(x => x.WorkflowDefinitionVersionId).HasDatabaseName($"{nameof(WorkflowDefinitionLabel)}_{nameof
 227        builder.HasIndex(x => x.LabelId).HasDatabaseName($"{nameof(WorkflowDefinitionLabel)}_{nameof(WorkflowDefinitionL
 228        builder.HasIndex(x => x.TenantId).HasDatabaseName($"{nameof(WorkflowDefinitionLabel)}_{nameof(WorkflowDefinition
 229    }
 30}