-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDialogEntityConfiguration.cs
44 lines (35 loc) · 1.5 KB
/
DialogEntityConfiguration.cs
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
44
using Digdir.Domain.Dialogporten.Domain.Dialogs.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using static Digdir.Domain.Dialogporten.Domain.Common.Constants;
namespace Digdir.Domain.Dialogporten.Infrastructure.Persistence.Configurations.Dialogs;
internal sealed class DialogEntityConfiguration : IEntityTypeConfiguration<DialogEntity>
{
public void Configure(EntityTypeBuilder<DialogEntity> builder)
{
builder.ToTable("Dialog");
builder.HasIndex(x => x.ServiceResource);
builder.Property(x => x.ServiceResource)
.HasMaxLength(DefaultMaxStringLength);
builder.Property(x => x.ServiceResource)
.UseCollation("C");
builder.HasIndex(x => x.Party);
builder.Property(x => x.Party)
.UseCollation("C");
builder.HasIndex(x => x.Org);
builder.Property(x => x.Org)
.UseCollation("C");
builder.HasIndex(x => new { x.Org, x.IdempotentKey })
.IsUnique()
.HasFilter($"\"{nameof(DialogEntity.IdempotentKey)}\" is not null");
builder.Property(x => x.IdempotentKey)
.HasMaxLength(36);
builder.HasIndex(x => x.CreatedAt);
builder.HasIndex(x => x.UpdatedAt);
builder.HasIndex(x => x.DueAt);
builder.HasIndex(x => x.VisibleFrom);
builder.HasIndex(x => x.ExtendedStatus);
builder.HasIndex(x => x.ExternalReference);
builder.HasIndex(x => x.Process);
}
}