86 lines
3.5 KiB
C#
86 lines
3.5 KiB
C#
using System;
|
|
using _0_Framework.Application;
|
|
using Company.Domain.InsurancWorkshopInfoAgg;
|
|
using Company.Domain.WorkshopAgg;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace CompanyManagment.EFCore.Mapping;
|
|
|
|
partial class WorkshopMapping : IEntityTypeConfiguration<Workshop>
|
|
{
|
|
public void Configure(EntityTypeBuilder<Workshop> builder)
|
|
{
|
|
builder.ToTable("Workshops");
|
|
builder.HasKey(x => x.id);
|
|
|
|
builder.Property(x => x.WorkshopName).HasMaxLength(255).IsRequired();
|
|
builder.Property(x => x.WorkshopSureName).HasMaxLength(255);
|
|
builder.Property(x => x.WorkshopFullName).HasMaxLength(255);
|
|
builder.Property(x => x.InsuranceCode).HasMaxLength(100);
|
|
builder.Property(x => x.TypeOfOwnership).HasMaxLength(100);
|
|
builder.Property(x => x.ArchiveCode).HasMaxLength(100);
|
|
builder.Property(x => x.AgentName).HasMaxLength(100);
|
|
builder.Property(x => x.AgentPhone).HasMaxLength(50);
|
|
builder.Property(x => x.State).HasMaxLength(100);
|
|
builder.Property(x => x.City).HasMaxLength(100);
|
|
builder.Property(x => x.Address).HasMaxLength(500);
|
|
builder.Property(x => x.TypeOfInsuranceSend).HasMaxLength(100);
|
|
builder.Property(x => x.TypeOfContract).HasMaxLength(100);
|
|
builder.Property(x => x.IsActiveString).HasMaxLength(10);
|
|
builder.Property(x => x.ContractTerm).HasMaxLength(10);
|
|
builder.Property(x => x.AgreementNumber).HasMaxLength(10);
|
|
builder.Property(x => x.Population).HasMaxLength(25);
|
|
builder.Property(x => x.IsClassified);
|
|
builder.Property(x => x.ZoneName).HasMaxLength(50);
|
|
builder.Property(x => x.InsuranceJobId).HasColumnType("bigint").IsRequired(false);
|
|
builder.Property(x => x.ComputeOptions).HasMaxLength(50);
|
|
builder.Property(x => x.BonusesOptions).HasMaxLength(50);
|
|
builder.Property(x => x.YearsOptions).HasMaxLength(50);
|
|
builder.Property(x => x.IsOldContract);
|
|
builder.Property(x => x.HasRollCallFreeVip).HasMaxLength(5);
|
|
builder.Property(x => x.WorkshopHolidayWorking);
|
|
|
|
builder.Property(x => x.CutContractEndOfYear).HasConversion(x => x.ToString()
|
|
, x => ((IsActive)Enum.Parse(typeof(IsActive), x))).HasMaxLength(5);
|
|
|
|
|
|
//builder.HasOne(x => x.Employer)
|
|
// .WithMany(x => x.Workshops)
|
|
// .HasForeignKey(x => x.EmployerId);
|
|
builder.HasMany(x => x.LeftWorks)
|
|
.WithOne(x => x.Workshop)
|
|
.HasForeignKey(x => x.WorkshopId);
|
|
|
|
builder.HasMany(x => x.Contracts2)
|
|
.WithOne(x => x.Workshop)
|
|
.HasForeignKey(x => x.WorkshopIds)
|
|
.OnDelete(DeleteBehavior.NoAction);
|
|
|
|
builder.HasMany(x => x.Checkouts)
|
|
.WithOne(x => x.Workshop)
|
|
.HasForeignKey(x => x.WorkshopId);
|
|
|
|
builder.HasOne(x => x.InsuranceWorkshopInfo)
|
|
.WithOne(x => x.Workshop)
|
|
.HasForeignKey<InsuranceWorkshopInfo>(x => x.WorkshopId);
|
|
|
|
|
|
builder.HasMany(x => x.PersonnelCodeList)
|
|
.WithOne(x => x.Workshop)
|
|
.HasForeignKey(x => x.WorkshopId);
|
|
|
|
builder.HasMany(x => x.RollCallServicesList)
|
|
.WithOne(x => x.Workshop)
|
|
.HasForeignKey(x => x.WorkshopId);
|
|
|
|
builder.HasMany(x => x.TaxLeftWorkCategoryList)
|
|
.WithOne(x => x.Workshop)
|
|
.HasForeignKey(x => x.WorkshopId);
|
|
|
|
builder.HasMany(x => x.CustomizeCheckouts)
|
|
.WithOne(x => x.Workshop)
|
|
.HasForeignKey(x => x.WorkshopId);
|
|
|
|
}
|
|
} |