Files
Backend-Api/AccountMangement.Infrastructure.EFCore/Mappings/TaskScheduleMapping.cs
MahanCh d52141f729 fix
2025-04-16 15:50:35 +03:30

23 lines
995 B
C#

using AccountManagement.Domain.TaskScheduleAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace AccountMangement.Infrastructure.EFCore.Mappings;
public class TaskScheduleMapping : IEntityTypeConfiguration<TaskSchedule>
{
public void Configure(EntityTypeBuilder<TaskSchedule> builder)
{
builder.ToTable("TaskSchedules");
builder.HasKey(x => x.id);
builder.Property(x => x.Count).HasMaxLength(10);
builder.Property(x => x.Type).HasConversion<string>().HasMaxLength(12);
builder.Property(x => x.UnitNumber).HasMaxLength(10);
builder.Property(x => x.UnitType).HasConversion<string>().HasMaxLength(10);
builder.Property(x => x.IsActive).HasConversion<string>().HasMaxLength(5);
builder.HasMany(x => x.TasksList).WithOne(x => x.TaskSchedule)
.HasForeignKey(x => x.TaskScheduleId);
}
}