init
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings;
|
||||
|
||||
public class BugSectionMapping : IEntityTypeConfiguration<BugSection>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<BugSection> builder)
|
||||
{
|
||||
builder.ToTable("BugSections");
|
||||
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.Property(x => x.Id)
|
||||
.ValueGeneratedNever();
|
||||
|
||||
builder.Property(x => x.TaskId)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.Status)
|
||||
.HasConversion<string>()
|
||||
.HasMaxLength(50)
|
||||
.IsRequired();
|
||||
|
||||
|
||||
builder.Property(x => x.Priority)
|
||||
.HasConversion<string>()
|
||||
.HasMaxLength(50)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(x => x.InitialDescription)
|
||||
.HasMaxLength(500)
|
||||
.IsRequired(false);
|
||||
|
||||
|
||||
// Navigation to ProjectTask (Task level)
|
||||
builder.HasOne(x => x.ProjectTask)
|
||||
.WithMany(t => t.BugSectionList)
|
||||
.HasForeignKey(x => x.TaskId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,12 @@ public class ProjectTaskMapping : IEntityTypeConfiguration<ProjectTask>
|
||||
.WithOne(s => s.Task)
|
||||
.HasForeignKey(s => s.TaskId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
|
||||
// One-to-many relationship with BugSections
|
||||
builder.HasMany(t => t.BugSectionList)
|
||||
.WithOne(s => s.ProjectTask)
|
||||
.HasForeignKey(s => s.TaskId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user