Files
Backend-Api/CompanyManagment.EFCore/Mapping/EmployeeComputeOptionsMapping.cs

26 lines
1.0 KiB
C#

using System;
using _0_Framework.Application;
using Company.Domain.EmployeeComputeOptionsAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class EmployeeComputeOptionsMapping : IEntityTypeConfiguration<EmployeeComputeOptions>
{
public void Configure(EntityTypeBuilder<EmployeeComputeOptions> builder)
{
builder.ToTable("EmployeeComputeOptions");
builder.HasKey(x => x.id);
builder.Property(x => x.WorkshopId);
builder.Property(x => x.EmployeeId);
builder.Property(x => x.ComputeOptions).HasMaxLength(50);
builder.Property(x => x.YearsOptions).HasMaxLength(50);
builder.Property(x => x.BonusesOptions).HasMaxLength(50);
builder.Property(x => x.ContractTerm).HasMaxLength(10);
builder.Property(x => x.CutContractEndOfYear).HasConversion(x => x.ToString()
, x => ((IsActive)Enum.Parse(typeof(IsActive), x))).HasMaxLength(5);
}
}