Files
Backend-Api/AccountMangement.Infrastructure.EFCore/Mappings/TaskScheduleMapping.cs
2024-08-24 19:13:34 +03:30

22 lines
864 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).HasMaxLength(12);
builder.Property(x => x.UnitNumber).HasMaxLength(10);
builder.Property(x => x.UnitType).HasMaxLength(10);
builder.HasMany(x => x.TasksList).WithOne(x => x.TaskSchedule)
.HasForeignKey(x => x.TaskScheduleId);
}
}