2024-02-20 20:36:23 +00:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
2024-05-05 02:18:20 +01: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 TutorialFolderConfiguration : IEntityTypeConfiguration<TutorialFolder>
|
|
|
|
{
|
|
|
|
public void Configure(EntityTypeBuilder<TutorialFolder> builder)
|
|
|
|
{
|
|
|
|
builder.ToTable("TutorialFolder");
|
|
|
|
builder.HasKey(e => e.Id);
|
|
|
|
|
|
|
|
builder.Property(e => e.Id).IsRequired();
|
|
|
|
builder.Property(e => e.Parent);
|
2024-02-23 17:51:22 +00:00
|
|
|
builder.Property(e => e.Slug).HasMaxLength(50).IsRequired();
|
|
|
|
builder.Property(e => e.Title).HasMaxLength(255).IsRequired();
|
2024-02-20 20:36:23 +00:00
|
|
|
builder.Property(e => e.PreviewImageUrl).HasConversion<UriToStringConverter>();
|
2024-02-23 17:57:08 +00:00
|
|
|
builder.Property(e => e.Visibility).HasConversion<EnumToStringConverter<Visibility>>();
|
2024-02-20 20:36:23 +00:00
|
|
|
}
|
|
|
|
}
|