using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Prefab.Data.Entities;
namespace Prefab.Data.Configs;
///
/// Configuration class for the entity.
///
public class SeederLogConfig() : Prefab.Data.Configs.EntityConfig(nameof(IPrefabDb.SeederLogs))
{
///
/// Configuration of Entity Framework mapping for the entity.
///
public override void Configure(EntityTypeBuilder builder)
{
ArgumentNullException.ThrowIfNull(builder);
builder
.HasKey(x => x.Id);
builder
.Property(x => x.Id)
.ValueGeneratedOnAdd();
builder.Property(x => x.SeederName)
.HasMaxLength(Rules.SeederNameMaxLength)
.IsRequired();
builder.Property(x => x.RunMode)
.HasMaxLength(Rules.SeederRunModeMaxLength)
.IsRequired();
builder
.Property(x => x.RunAt)
.IsRequired();
}
///
/// Validation rules for the entity.
///
public static class Rules
{
///
/// Maximum length to set for the seeder name.
///
public const int SeederNameMaxLength = 256;
///
/// Maximum length to set for the seeder name.
///
public const int SeederRunModeMaxLength = 64;
}
}