2024-02-20 20:36:23 +00:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
2024-05-05 01:18:20 +00:00
|
|
|
using OliverBooth.Common.Data;
|
2024-02-20 20:36:23 +00:00
|
|
|
|
|
|
|
namespace OliverBooth.Data.Web.Configuration;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Represents the configuration for the <see cref="Template" /> entity.
|
|
|
|
/// </summary>
|
|
|
|
internal sealed class TutorialArticleConfiguration : IEntityTypeConfiguration<TutorialArticle>
|
|
|
|
{
|
|
|
|
public void Configure(EntityTypeBuilder<TutorialArticle> builder)
|
|
|
|
{
|
|
|
|
builder.ToTable("TutorialArticle");
|
|
|
|
builder.HasKey(e => e.Id);
|
|
|
|
|
|
|
|
builder.Property(e => e.Id).IsRequired();
|
|
|
|
builder.Property(e => e.Folder).IsRequired();
|
2024-04-27 14:41:19 +00:00
|
|
|
builder.Property(e => e.Excerpt).HasMaxLength(512).IsRequired(false);
|
2024-02-20 20:36:23 +00:00
|
|
|
builder.Property(e => e.Published).IsRequired();
|
|
|
|
builder.Property(e => e.Updated);
|
|
|
|
builder.Property(e => e.Slug).IsRequired();
|
|
|
|
builder.Property(e => e.Title).IsRequired();
|
|
|
|
builder.Property(e => e.PreviewImageUrl).HasConversion<UriToStringConverter>();
|
|
|
|
builder.Property(e => e.NextPart);
|
|
|
|
builder.Property(e => e.PreviousPart);
|
2024-05-01 15:47:31 +00:00
|
|
|
builder.Property(e => e.RedirectFrom).IsRequired(false);
|
2024-02-23 17:57:08 +00:00
|
|
|
builder.Property(e => e.Visibility).HasConversion<EnumToStringConverter<Visibility>>();
|
2024-04-27 14:59:05 +00:00
|
|
|
builder.Property(e => e.EnableComments).IsRequired();
|
2024-02-20 20:36:23 +00:00
|
|
|
}
|
|
|
|
}
|