Files
Backend-Api/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/TaskSectionAdditionalTimeMapping.cs

44 lines
1.3 KiB
C#

using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using GozareshgirProgramManager.Domain.ProjectAgg.Entities.Task.TaskSection;
using GozareshgirProgramManager.Infrastructure.Persistence._Common;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings;
public class TaskSectionAdditionalTimeMapping : IEntityTypeConfiguration<TaskSectionAdditionalTime>
{
public void Configure(EntityTypeBuilder<TaskSectionAdditionalTime> builder)
{
builder.ToTable("TaskSectionAdditionalTimes");
builder.HasKey(at => at.Id);
builder.Property(at => at.Id)
.ValueGeneratedNever();
builder.Property(at => at.Hours)
.HasTimeSpanConversion()
.IsRequired();
builder.Property(at => at.Reason)
.HasMaxLength(500)
.IsRequired(false);
builder.Property(at => at.AddedByUserId)
.IsRequired(false);
builder.Property(at => at.AddedAt)
.IsRequired();
builder.Property(at => at.CreationDate)
.IsRequired();
builder.Property(x=>x.Type)
.HasConversion<string>()
.HasMaxLength(50);
// Ignore domain events
builder.Ignore(at => at.DomainEvents);
}
}