-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathSagaSnapshotConfiguration.cs
More file actions
27 lines (24 loc) · 1.1 KB
/
SagaSnapshotConfiguration.cs
File metadata and controls
27 lines (24 loc) · 1.1 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
namespace ServiceControl.Audit.Persistence.Sql.Core.EntityConfigurations;
using Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
class SagaSnapshotConfiguration : IEntityTypeConfiguration<SagaSnapshotEntity>
{
public void Configure(EntityTypeBuilder<SagaSnapshotEntity> builder)
{
builder.ToTable("SagaSnapshots");
builder.HasKey(e => new { e.Id, e.CreatedOn });
builder.Property(e => e.Id).ValueGeneratedOnAdd();
builder.Property(e => e.CreatedOn).IsRequired();
builder.Property(e => e.SagaId).IsRequired();
builder.Property(e => e.SagaType).IsRequired();
builder.Property(e => e.StartTime).IsRequired();
builder.Property(e => e.FinishTime);
builder.Property(e => e.Status).IsRequired();
builder.Property(e => e.StateAfterChange).IsRequired();
builder.Property(e => e.InitiatingMessageJson).IsRequired();
builder.Property(e => e.OutgoingMessagesJson).IsRequired();
builder.Property(e => e.Endpoint).IsRequired();
builder.HasIndex(e => e.SagaId);
}
}