2023-08-11 15:51:20 +01:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
2023-08-08 21:03:41 +01:00
|
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
|
2024-03-02 00:43:56 +00:00
|
|
|
namespace OliverBooth.Common.Data.Web.Configuration;
|
2023-08-08 21:03:41 +01:00
|
|
|
|
|
|
|
/// <summary>
|
2023-08-13 13:27:44 +01:00
|
|
|
/// Represents the configuration for the <see cref="Template" /> entity.
|
2023-08-08 21:03:41 +01:00
|
|
|
/// </summary>
|
2023-08-13 13:27:44 +01:00
|
|
|
internal sealed class TemplateConfiguration : IEntityTypeConfiguration<Template>
|
2023-08-08 21:03:41 +01:00
|
|
|
{
|
2023-08-13 13:27:44 +01:00
|
|
|
public void Configure(EntityTypeBuilder<Template> builder)
|
2023-08-08 21:03:41 +01:00
|
|
|
{
|
2023-08-13 13:27:44 +01:00
|
|
|
builder.ToTable("Template");
|
2023-08-15 17:04:43 +01:00
|
|
|
builder.HasKey(e => new { e.Name, e.Variant });
|
2023-08-08 21:03:41 +01:00
|
|
|
|
2023-08-15 17:04:43 +01:00
|
|
|
builder.Property(e => e.Name).HasMaxLength(50).IsRequired();
|
|
|
|
builder.Property(e => e.Variant).HasMaxLength(50).IsRequired();
|
2023-08-08 21:03:41 +01:00
|
|
|
builder.Property(e => e.FormatString).IsRequired();
|
|
|
|
}
|
|
|
|
}
|