30 lines
949 B
C#
30 lines
949 B
C#
using Company.Domain.LeftWorkAgg;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace CompanyManagment.EFCore.Mapping;
|
|
|
|
public class LeftWorkMapping : IEntityTypeConfiguration<LeftWork>
|
|
{
|
|
public void Configure(EntityTypeBuilder<LeftWork> builder)
|
|
{
|
|
builder.ToTable("LeftWork");
|
|
builder.HasKey(x => x.id);
|
|
|
|
builder.Property(x => x.EmployeeFullName).HasMaxLength(255);
|
|
builder.Property(x => x.WorkshopName).HasMaxLength(255);
|
|
builder.Property(x => x.ComputeOptions).HasMaxLength(50);
|
|
builder.Property(x => x.BonusesOptions).HasMaxLength(50);
|
|
|
|
builder.Ignore(x => x.HasLeft);
|
|
|
|
builder.HasOne(x => x.Employee)
|
|
.WithMany(x => x.LeftWorks)
|
|
.HasForeignKey(x => x.EmployeeId);
|
|
builder.HasOne(x => x.Workshop)
|
|
.WithMany(x => x.LeftWorks)
|
|
.HasForeignKey(x => x.WorkshopId);
|
|
|
|
|
|
}
|
|
} |