24 lines
682 B
C#
24 lines
682 B
C#
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>());
|
|
}
|
|
} |