< Summary

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

File(s)

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

#LineLine coverage
 1using Elsa.KeyValues.Entities;
 2using Elsa.Workflows.Runtime.Entities;
 3using Microsoft.EntityFrameworkCore;
 4using Microsoft.EntityFrameworkCore.Metadata.Builders;
 5
 6namespace Elsa.Persistence.EFCore.Modules.Runtime;
 7
 8/// <summary>
 9/// EF Core configuration for various sets of <see cref="DbContext"/>.
 10/// </summary>
 11public class Configurations :
 12    IEntityTypeConfiguration<StoredTrigger>,
 13    IEntityTypeConfiguration<WorkflowExecutionLogRecord>,
 14    IEntityTypeConfiguration<ActivityExecutionRecord>,
 15    IEntityTypeConfiguration<StoredBookmark>,
 16    IEntityTypeConfiguration<BookmarkQueueItem>,
 17    IEntityTypeConfiguration<SerializedKeyValuePair>,
 18    IEntityTypeConfiguration<WorkflowInboxMessage>
 19{
 20    /// <inheritdoc />
 21    public void Configure(EntityTypeBuilder<ActivityExecutionRecord> builder)
 22    {
 123        builder.Ignore(x => x.ActivityState);
 124        builder.Ignore(x => x.Exception);
 125        builder.Ignore(x => x.Payload);
 126        builder.Ignore(x => x.Outputs);
 127        builder.Ignore(x => x.Metadata);
 128        builder.Ignore(x => x.Properties);
 129        builder.Property<string>("SerializedActivityState");
 130        builder.Property<string>("SerializedActivityStateCompressionAlgorithm");
 131        builder.Property<string>("SerializedException");
 132        builder.Property<string>("SerializedPayload");
 133        builder.Property<string>("SerializedOutputs");
 134        builder.Property<string>("SerializedProperties");
 135        builder.Property<string>("SerializedMetadata");
 136        builder.Property(x => x.Status).HasConversion<string>();
 137        builder.HasIndex(x => x.WorkflowInstanceId).HasDatabaseName($"IX_{nameof(ActivityExecutionRecord)}_{nameof(Activ
 138        builder.HasIndex(x => x.ActivityId).HasDatabaseName($"IX_{nameof(ActivityExecutionRecord)}_{nameof(ActivityExecu
 139        builder.HasIndex(x => x.ActivityNodeId).HasDatabaseName($"IX_{nameof(ActivityExecutionRecord)}_{nameof(ActivityE
 140        builder.HasIndex(x => x.ActivityType).HasDatabaseName($"IX_{nameof(ActivityExecutionRecord)}_{nameof(ActivityExe
 141        builder.HasIndex(x => x.ActivityTypeVersion).HasDatabaseName($"IX_{nameof(ActivityExecutionRecord)}_{nameof(Acti
 142        builder.HasIndex(x => new
 143        {
 144            x.ActivityType,
 145            x.ActivityTypeVersion
 146        }).HasDatabaseName($"IX_{nameof(ActivityExecutionRecord)}_{nameof(ActivityExecutionRecord.ActivityType)}_{nameof
 147        builder.HasIndex(x => x.ActivityName).HasDatabaseName($"IX_{nameof(ActivityExecutionRecord)}_{nameof(ActivityExe
 148        builder.HasIndex(x => x.StartedAt).HasDatabaseName($"IX_{nameof(ActivityExecutionRecord)}_{nameof(ActivityExecut
 149        builder.HasIndex(x => x.HasBookmarks).HasDatabaseName($"IX_{nameof(ActivityExecutionRecord)}_{nameof(ActivityExe
 150        builder.HasIndex(x => x.Status).HasDatabaseName($"IX_{nameof(ActivityExecutionRecord)}_{nameof(ActivityExecution
 151        builder.HasIndex(x => x.CompletedAt).HasDatabaseName($"IX_{nameof(ActivityExecutionRecord)}_{nameof(ActivityExec
 152        builder.HasIndex(x => x.TenantId).HasDatabaseName($"IX_{nameof(ActivityExecutionRecord)}_{nameof(ActivityExecuti
 153    }
 54
 55    public void Configure(EntityTypeBuilder<BookmarkQueueItem> builder)
 56    {
 157        builder.Ignore(x => x.Options);
 158        builder.Property<string>("SerializedOptions");
 159        builder.HasIndex(x => x.StimulusHash, $"IX_{nameof(BookmarkQueueItem)}_{nameof(BookmarkQueueItem.StimulusHash)}"
 160        builder.HasIndex(x => x.WorkflowInstanceId, $"IX_{nameof(BookmarkQueueItem)}_{nameof(BookmarkQueueItem.WorkflowI
 161        builder.HasIndex(x => x.CorrelationId, $"IX_{nameof(BookmarkQueueItem)}_{nameof(BookmarkQueueItem.CorrelationId)
 162        builder.HasIndex(x => x.BookmarkId, $"IX_{nameof(BookmarkQueueItem)}_{nameof(BookmarkQueueItem.BookmarkId)}");
 163        builder.HasIndex(x => x.ActivityInstanceId, $"IX_{nameof(BookmarkQueueItem)}_{nameof(BookmarkQueueItem.ActivityI
 164        builder.HasIndex(x => x.ActivityTypeName, $"IX_{nameof(BookmarkQueueItem)}_{nameof(BookmarkQueueItem.ActivityTyp
 165        builder.HasIndex(x => x.CreatedAt, $"IX_{nameof(BookmarkQueueItem)}_{nameof(BookmarkQueueItem.CreatedAt)}");
 166        builder.HasIndex(x => x.TenantId, $"IX_{nameof(BookmarkQueueItem)}_{nameof(BookmarkQueueItem.TenantId)}");
 167    }
 68
 69    /// <inheritdoc />
 70    public void Configure(EntityTypeBuilder<SerializedKeyValuePair> builder)
 71    {
 172        builder.HasKey(x => x.Id);
 173        builder.Ignore(x => x.Key);
 174        builder.HasIndex(x => x.TenantId, $"IX_{nameof(SerializedKeyValuePair)}_{nameof(SerializedKeyValuePair.TenantId)
 175    }
 76
 77    /// <inheritdoc />
 78    public void Configure(EntityTypeBuilder<StoredBookmark> builder)
 79    {
 180        builder.Ignore(x => x.Payload);
 181        builder.Ignore(x => x.Metadata);
 182        builder.HasKey(b => b.Id);
 183        builder.Property<string>("SerializedPayload");
 184        builder.Property<string>("SerializedMetadata");
 185        builder.HasIndex(x => x.ActivityTypeName, $"IX_{nameof(StoredBookmark)}_{nameof(StoredBookmark.ActivityTypeName)
 186        builder.HasIndex(x => x.Name, $"IX_{nameof(StoredBookmark)}_{nameof(StoredBookmark.Name)}");
 187        builder.HasIndex(x => x.Hash, $"IX_{nameof(StoredBookmark)}_{nameof(StoredBookmark.Hash)}");
 188        builder.HasIndex(x => x.WorkflowInstanceId, $"IX_{nameof(StoredBookmark)}_{nameof(StoredBookmark.WorkflowInstanc
 189        builder.HasIndex(x => x.ActivityInstanceId, $"IX_{nameof(StoredBookmark)}_{nameof(StoredBookmark.ActivityInstanc
 190        builder.HasIndex(x => x.CreatedAt, $"IX_{nameof(StoredBookmark)}_{nameof(StoredBookmark.CreatedAt)}");
 191        builder.HasIndex(x => new
 192            {
 193                x.ActivityTypeName,
 194                x.Hash
 195            }, $"IX_{nameof(StoredBookmark)}_{nameof(StoredBookmark.ActivityTypeName)}_{nameof(StoredBookmark.Hash)}");
 196        builder.HasIndex(x => new
 197            {
 198                x.ActivityTypeName,
 199                x.Hash,
 1100                x.WorkflowInstanceId
 1101            }, $"IX_{nameof(StoredBookmark)}_{nameof(StoredBookmark.ActivityTypeName)}_{nameof(StoredBookmark.Hash)}_{na
 1102        builder.HasIndex(x => new
 1103            {
 1104                ActivityTypeName = x.Name,
 1105                x.Hash
 1106            }, $"IX_{nameof(StoredBookmark)}_{nameof(StoredBookmark.Name)}_{nameof(StoredBookmark.Hash)}");
 1107        builder.HasIndex(x => new
 1108            {
 1109                ActivityTypeName = x.Name,
 1110                x.Hash,
 1111                x.WorkflowInstanceId
 1112            }, $"IX_{nameof(StoredBookmark)}_{nameof(StoredBookmark.Name)}_{nameof(StoredBookmark.Hash)}_{nameof(StoredB
 1113        builder.HasIndex(x => x.TenantId, $"IX_{nameof(StoredBookmark)}_{nameof(StoredBookmark.TenantId)}");
 1114    }
 115
 116    /// <inheritdoc />
 117    public void Configure(EntityTypeBuilder<StoredTrigger> builder)
 118    {
 1119        builder.Ignore(x => x.Payload);
 1120        builder.Property<string>("SerializedPayload");
 1121        builder.HasIndex(x => x.WorkflowDefinitionId).HasDatabaseName($"IX_{nameof(StoredTrigger)}_{nameof(StoredTrigger
 1122        builder.HasIndex(x => x.WorkflowDefinitionVersionId).HasDatabaseName($"IX_{nameof(StoredTrigger)}_{nameof(Stored
 1123        builder.HasIndex(x => x.Name).HasDatabaseName($"IX_{nameof(StoredTrigger)}_{nameof(StoredTrigger.Name)}");
 1124        builder.HasIndex(x => x.Hash).HasDatabaseName($"IX_{nameof(StoredTrigger)}_{nameof(StoredTrigger.Hash)}");
 1125        builder.HasIndex(x => x.TenantId).HasDatabaseName($"IX_{nameof(StoredTrigger)}_{nameof(StoredTrigger.TenantId)}"
 1126    }
 127
 128    /// <inheritdoc />
 129    public void Configure(EntityTypeBuilder<WorkflowExecutionLogRecord> builder)
 130    {
 1131        builder.Ignore(x => x.ActivityState);
 1132        builder.Ignore(x => x.Payload);
 1133        builder.Property<string>("SerializedActivityState");
 1134        builder.Property<string>("SerializedPayload");
 1135        builder.HasIndex(x => x.Timestamp).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(WorkflowExe
 1136        builder.HasIndex(x => x.Sequence).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(WorkflowExec
 1137        builder.HasIndex(x => new
 1138        {
 1139            x.Timestamp,
 1140            x.Sequence
 1141        }).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(WorkflowExecutionLogRecord.Timestamp)}_{nam
 1142        builder.HasIndex(x => x.ActivityInstanceId).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(Wo
 1143        builder.HasIndex(x => x.ParentActivityInstanceId).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nam
 1144        builder.HasIndex(x => x.ActivityId).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(WorkflowEx
 1145        builder.HasIndex(x => x.ActivityNodeId).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(Workfl
 1146        builder.HasIndex(x => x.ActivityType).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(Workflow
 1147        builder.HasIndex(x => x.ActivityTypeVersion).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(W
 1148        builder.HasIndex(x => new
 1149        {
 1150            x.ActivityType,
 1151            x.ActivityTypeVersion
 1152        }).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(WorkflowExecutionLogRecord.ActivityType)}_{
 1153        builder.HasIndex(x => x.ActivityName).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(Workflow
 1154        builder.HasIndex(x => x.EventName).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(WorkflowExe
 1155        builder.HasIndex(x => x.WorkflowDefinitionId).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(
 1156        builder.HasIndex(x => x.WorkflowDefinitionVersionId).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{
 1157        builder.HasIndex(x => x.WorkflowInstanceId).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(Wo
 1158        builder.HasIndex(x => x.WorkflowVersion).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(Workf
 1159        builder.HasIndex(x => x.TenantId).HasDatabaseName($"IX_{nameof(WorkflowExecutionLogRecord)}_{nameof(WorkflowExec
 1160    }
 161
 162    public void Configure(EntityTypeBuilder<WorkflowInboxMessage> builder)
 163    {
 1164        builder.Ignore(x => x.Input);
 1165        builder.Ignore(x => x.BookmarkPayload);
 1166        builder.Property<string>("SerializedInput");
 1167        builder.Property<string>("SerializedBookmarkPayload");
 1168        builder.HasIndex(x => x.ActivityTypeName, $"IX_{nameof(WorkflowInboxMessage)}_{nameof(WorkflowInboxMessage.Activ
 1169        builder.HasIndex(x => x.Hash, $"IX_{nameof(WorkflowInboxMessage)}_{nameof(WorkflowInboxMessage.Hash)}");
 1170        builder.HasIndex(x => x.WorkflowInstanceId, $"IX_{nameof(WorkflowInboxMessage)}_{nameof(WorkflowInboxMessage.Wor
 1171        builder.HasIndex(x => x.CorrelationId, $"IX_{nameof(WorkflowInboxMessage)}_{nameof(WorkflowInboxMessage.Correlat
 1172        builder.HasIndex(x => x.ActivityInstanceId, $"IX_{nameof(WorkflowInboxMessage)}_{nameof(WorkflowInboxMessage.Act
 1173        builder.HasIndex(x => x.CreatedAt, $"IX_{nameof(WorkflowInboxMessage)}_{nameof(WorkflowInboxMessage.CreatedAt)}"
 1174        builder.HasIndex(x => x.ExpiresAt, $"IX_{nameof(WorkflowInboxMessage)}_{nameof(WorkflowInboxMessage.ExpiresAt)}"
 1175    }
 176}