project reorganized
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using WatchIt.Database.Model.Person;
|
||||
|
||||
namespace WatchIt.Database.Model.Configuration.Person;
|
||||
|
||||
public class PersonActorRoleConfiguration : IEntityTypeConfiguration<PersonActorRole>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PersonActorRole> builder)
|
||||
{
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.HasIndex(x => x.Id)
|
||||
.IsUnique();
|
||||
builder.Property(x => x.Id)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(x => x.Person)
|
||||
.WithMany(x => x.PersonActorRoles)
|
||||
.HasForeignKey(x => x.PersonId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.PersonId)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(x => x.Media)
|
||||
.WithMany(x => x.PersonActorRoles)
|
||||
.HasForeignKey(x => x.MediaId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.MediaId)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(x => x.PersonActorRoleType)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.PersonActorRoleTypeId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.PersonActorRoleTypeId)
|
||||
.IsRequired();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using WatchIt.Database.Model.Person;
|
||||
using WatchIt.Database.Model.Seeding;
|
||||
|
||||
namespace WatchIt.Database.Model.Configuration.Person;
|
||||
|
||||
public class PersonActorRoleTypeConfiguration : IEntityTypeConfiguration<PersonActorRoleType>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PersonActorRoleType> builder)
|
||||
{
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.HasIndex(x => x.Id)
|
||||
.IsUnique();
|
||||
builder.Property(x => x.Id)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.Name)
|
||||
.HasMaxLength(100)
|
||||
.IsRequired();
|
||||
|
||||
// Data
|
||||
builder.HasData(DataReader.Read<PersonActorRoleType>());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace WatchIt.Database.Model.Configuration.Person;
|
||||
|
||||
public class PersonConfiguration : IEntityTypeConfiguration<Model.Person.Person>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Model.Person.Person> builder)
|
||||
{
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.HasIndex(x => x.Id)
|
||||
.IsUnique();
|
||||
builder.Property(x => x.Id)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.Name)
|
||||
.HasMaxLength(100)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.FullName)
|
||||
.HasMaxLength(200);
|
||||
|
||||
builder.Property(x => x.Description)
|
||||
.HasMaxLength(1000);
|
||||
|
||||
builder.Property(x => x.BirthDate);
|
||||
|
||||
builder.Property(x => x.DeathDate);
|
||||
|
||||
builder.HasOne(x => x.Gender)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.GenderId);
|
||||
builder.Property(x => x.GenderId);
|
||||
|
||||
builder.HasOne(x => x.PersonPhoto)
|
||||
.WithOne(x => x.Person)
|
||||
.HasForeignKey<Model.Person.Person>(e => e.PersonPhotoId);
|
||||
builder.Property(x => x.PersonPhotoId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using WatchIt.Database.Model.Person;
|
||||
|
||||
namespace WatchIt.Database.Model.Configuration.Person;
|
||||
|
||||
public class PersonCreatorRoleConfiguration : IEntityTypeConfiguration<PersonCreatorRole>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PersonCreatorRole> builder)
|
||||
{
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.HasIndex(x => x.Id)
|
||||
.IsUnique();
|
||||
builder.Property(x => x.Id)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(x => x.Person)
|
||||
.WithMany(x => x.PersonCreatorRoles)
|
||||
.HasForeignKey(x => x.PersonId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.PersonId)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(x => x.Media)
|
||||
.WithMany(x => x.PersonCreatorRoles)
|
||||
.HasForeignKey(x => x.MediaId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.MediaId)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(x => x.PersonCreatorRoleType)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.PersonCreatorRoleTypeId)
|
||||
.IsRequired();
|
||||
builder.Property(x => x.PersonCreatorRoleTypeId)
|
||||
.IsRequired();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using WatchIt.Database.Model.Person;
|
||||
using WatchIt.Database.Model.Seeding;
|
||||
|
||||
namespace WatchIt.Database.Model.Configuration.Person;
|
||||
|
||||
public class PersonCreatorRoleTypeConfiguration : IEntityTypeConfiguration<PersonCreatorRoleType>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PersonCreatorRoleType> builder)
|
||||
{
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.HasIndex(x => x.Id)
|
||||
.IsUnique();
|
||||
builder.Property(x => x.Id)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.Name)
|
||||
.HasMaxLength(100)
|
||||
.IsRequired();
|
||||
|
||||
// Data
|
||||
builder.HasData(DataReader.Read<PersonCreatorRoleType>());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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()");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user