oliverbooth.dev/OliverBooth/Data/Blog/Configuration/AuthorConfiguration.cs
Oliver Booth bd999f0ed8
feat: add preliminary /blog routes
This change also introduces toml file config
2023-08-06 15:57:44 +01:00

22 lines
708 B
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace OliverBooth.Data.Blog.Configuration;
/// <summary>
/// Represents the configuration for the <see cref="Author" /> entity.
/// </summary>
internal sealed class AuthorConfiguration : IEntityTypeConfiguration<Author>
{
/// <inheritdoc />
public void Configure(EntityTypeBuilder<Author> builder)
{
builder.ToTable("Author");
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedOnAdd();
builder.Property(e => e.Name).HasMaxLength(100).IsRequired();
builder.Property(e => e.EmailAddress).HasMaxLength(255).IsRequired(false);
}
}