-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathProcessedMessageConfiguration.cs
More file actions
43 lines (37 loc) · 1.82 KB
/
ProcessedMessageConfiguration.cs
File metadata and controls
43 lines (37 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
namespace ServiceControl.Audit.Persistence.Sql.Core.EntityConfigurations;
using Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
class ProcessedMessageConfiguration : IEntityTypeConfiguration<ProcessedMessageEntity>
{
public void Configure(EntityTypeBuilder<ProcessedMessageEntity> builder)
{
builder.ToTable("ProcessedMessages");
builder.HasKey(e => new { e.Id, e.CreatedOn });
builder.Property(e => e.Id).ValueGeneratedOnAdd();
builder.Property(e => e.CreatedOn).IsRequired();
builder.Property(e => e.UniqueMessageId).HasMaxLength(200).IsRequired();
// JSON columns
builder.Property(e => e.HeadersJson).IsRequired();
// Full-text search column (combines header values + body text)
builder.Property(e => e.SearchableContent);
// Denormalized query fields
builder.Property(e => e.MessageId).HasMaxLength(200);
builder.Property(e => e.MessageType).HasMaxLength(500);
builder.Property(e => e.ConversationId).HasMaxLength(200);
builder.Property(e => e.ReceivingEndpointName).HasMaxLength(500);
builder.Property(e => e.BodyUrl).HasMaxLength(500);
builder.Property(e => e.TimeSent);
builder.Property(e => e.IsSystemMessage).IsRequired();
builder.Property(e => e.Status).IsRequired();
builder.Property(e => e.BodySize).IsRequired();
builder.Property(e => e.BodyNotStored).IsRequired();
builder.Property(e => e.CriticalTimeTicks);
builder.Property(e => e.ProcessingTimeTicks);
builder.Property(e => e.DeliveryTimeTicks);
builder.HasIndex(e => e.UniqueMessageId);
builder.HasIndex(e => e.ConversationId);
builder.HasIndex(e => e.MessageId);
builder.HasIndex(e => e.TimeSent);
}
}