Files
Backend-Api/CompanyManagment.EFCore/Mapping/GroupPlanMapping.cs
2024-07-09 19:31:25 +03:30

29 lines
960 B
C#

using Company.Domain.GroupPlanAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class GroupPlanMapping : IEntityTypeConfiguration<GroupPlan>
{
public void Configure(EntityTypeBuilder<GroupPlan> builder)
{
builder.ToTable("GroupPlans");
builder.HasKey(x => x.id);
builder.Property(x => x.GroupNo).HasMaxLength(2);
builder.Property(x => x.JobSalary);
builder.Property(x => x.AnnualSalary);
builder.Property(x => x.BaseSalary);
builder.Property(x => x.WorkshopPlanId);
builder.Property(x => x.WorkshopId);
builder.HasOne(x => x.WorkshopPlan)
.WithMany(x => x.GroupPlans)
.HasForeignKey(x => x.WorkshopPlanId);
builder.HasMany(x => x.GroupPlanJobItems)
.WithOne(x => x.GroupPlan)
.HasForeignKey(x => x.GroupPlanId);
}
}