Files
WatchIt/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Common/GenderConfiguration.cs

24 lines
682 B
C#
Raw Normal View History

2024-04-27 22:36:16 +02:00
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using WatchIt.Database.Model.Common;
using WatchIt.Database.Model.Seeding;
namespace WatchIt.Database.Model.Configuration.Common;
public class GenderConfiguration : IEntityTypeConfiguration<Gender>
{
public void Configure(EntityTypeBuilder<Gender> builder)
{
builder.HasKey(x => x.Id);
builder.HasIndex(x => x.Id)
.IsUnique();
builder.Property(x => x.Id)
.IsRequired();
builder.Property(x => x.Name)
.IsRequired();
// Data
builder.HasData(DataReader.Read<Gender>());
}
}