Files
WatchIt/WatchIt.Database/WatchIt.Database.Model/WatchIt.Database.Model.Configuration/Person/PersonPhotoImageConfiguration.cs

29 lines
856 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.Person;
namespace WatchIt.Database.Model.Configuration.Person;
public class PersonPhotoImageConfiguration : IEntityTypeConfiguration<PersonPhotoImage>
{
public void Configure(EntityTypeBuilder<PersonPhotoImage> builder)
{
builder.HasKey(x => x.Id);
builder.HasIndex(x => x.Id)
.IsUnique();
builder.Property(x => x.Id)
.IsRequired();
builder.Property(x => x.Image)
.HasMaxLength(-1)
.IsRequired();
builder.Property(x => x.MimeType)
.HasMaxLength(50)
.IsRequired();
builder.Property(x => x.UploadDate)
.IsRequired()
.HasDefaultValueSql("now()");
}
}