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