2023-08-11 15:51:20 +01:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
2023-08-06 15:57:23 +01:00
|
|
|
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);
|
|
|
|
|
2023-08-11 14:09:13 +01:00
|
|
|
builder.Property(e => e.Id);
|
2023-08-06 15:57:23 +01:00
|
|
|
builder.Property(e => e.Name).HasMaxLength(100).IsRequired();
|
|
|
|
builder.Property(e => e.EmailAddress).HasMaxLength(255).IsRequired(false);
|
|
|
|
}
|
|
|
|
}
|