2023-08-07 23:20:38 +00:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2023-08-06 14:57:23 +00:00
|
|
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
|
|
|
|
|
|
namespace OliverBooth.Data.Blog.Configuration;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents the configuration for the <see cref="BlogPost" /> entity.
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal sealed class BlogPostConfiguration : IEntityTypeConfiguration<BlogPost>
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public void Configure(EntityTypeBuilder<BlogPost> builder)
|
|
|
|
|
{
|
|
|
|
|
builder.ToTable("BlogPost");
|
|
|
|
|
builder.HasKey(e => e.Id);
|
|
|
|
|
|
|
|
|
|
builder.Property(e => e.Id).ValueGeneratedOnAdd();
|
|
|
|
|
builder.Property(e => e.WordPressId).IsRequired(false);
|
|
|
|
|
builder.Property(e => e.Slug).HasMaxLength(100).IsRequired();
|
|
|
|
|
builder.Property(e => e.AuthorId).IsRequired();
|
|
|
|
|
builder.Property(e => e.Published).IsRequired();
|
2023-08-07 22:42:59 +00:00
|
|
|
|
builder.Property(e => e.Updated).IsRequired(false);
|
2023-08-06 14:57:23 +00:00
|
|
|
|
builder.Property(e => e.Title).HasMaxLength(255).IsRequired();
|
|
|
|
|
builder.Property(e => e.Body).IsRequired();
|
2023-08-07 23:20:21 +00:00
|
|
|
|
builder.Property(e => e.IsRedirect).IsRequired();
|
|
|
|
|
builder.Property(e => e.RedirectUrl).IsRequired(false);
|
2023-08-07 23:20:38 +00:00
|
|
|
|
builder.Property(e => e.EnableComments).IsRequired();
|
2023-08-08 11:39:49 +00:00
|
|
|
|
builder.Property(e => e.DisqusDomain).IsRequired(false);
|
|
|
|
|
builder.Property(e => e.DisqusIdentifier).IsRequired(false);
|
|
|
|
|
builder.Property(e => e.DisqusPath).IsRequired(false);
|
2023-08-06 14:57:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|