重构项目结构,移除Assignment相关功能,优化Submission模块
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 12s
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 12s
This commit is contained in:
@@ -4,9 +4,9 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace TechHelper.Context.Configuration
|
||||
{
|
||||
public class AssignmentAttachmentConfiguration : IEntityTypeConfiguration<AssignmentAttachment>
|
||||
public class AssignmentAttachmentConfiguration : IEntityTypeConfiguration<ExamAttachment>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<AssignmentAttachment> builder)
|
||||
public void Configure(EntityTypeBuilder<ExamAttachment> builder)
|
||||
{
|
||||
builder.ToTable("assignment_attachments");
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace TechHelper.Context.Configuration
|
||||
.HasDefaultValue(false);
|
||||
|
||||
// Configure the relationship explicitly
|
||||
builder.HasOne(aa => aa.Assignment) // An AssignmentAttachment has one Assignment
|
||||
.WithMany(a => a.AssignmentAttachments) // An Assignment has many AssignmentAttachments (assuming 'Attachments' collection in Assignment)
|
||||
builder.HasOne(aa => aa.Exam) // An AssignmentAttachment has one Assignment
|
||||
.WithMany(a => a.ExamAttachments) // An Assignment has many AssignmentAttachments (assuming 'Attachments' collection in Assignment)
|
||||
.HasForeignKey(aa => aa.AssignmentId) // The foreign key is AssignmentAttachment.AssignmentId
|
||||
.IsRequired() // It's a required relationship based on your [Required] attribute
|
||||
.OnDelete(DeleteBehavior.Cascade); // If an Assignment is deleted, its attachments should also be deleted
|
||||
|
||||
Reference in New Issue
Block a user