63 lines
1.4 KiB
C#
63 lines
1.4 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Entities.Contracts
|
|
{
|
|
[Table("assignment_questions")]
|
|
public class AssignmentQuestion
|
|
{
|
|
[Key]
|
|
[Column("id")]
|
|
public Guid Id { get; set; }
|
|
|
|
[Column("question_id")]
|
|
public Guid? QuestionId { get; set; } // 设为可空
|
|
|
|
// 当 IsGroup 为 true 时,此为 QuestionGroup 的外键
|
|
[Column("question_group_id")] // 新增一个外键列
|
|
public Guid? QuestionGroupId { get; set; } // 设为可空
|
|
|
|
[Required]
|
|
[Column("group_id")]
|
|
[ForeignKey("AssignmentGroup")]
|
|
public Guid AssignmentGroupId { get; set; }
|
|
|
|
|
|
[Required]
|
|
[Column("question_number")]
|
|
public byte QuestionNumber { get; set; }
|
|
|
|
|
|
[Column("created_at")]
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
[Column("score")]
|
|
public float? Score { get; set; }
|
|
|
|
[Required]
|
|
[Column("bgroup")]
|
|
public bool IsGroup { get; set; }
|
|
|
|
[Column("deleted")]
|
|
public bool IsDeleted { get; set; }
|
|
|
|
|
|
public Question Question { get; set; }
|
|
public QuestionGroup QuestionGroup { get; set; }
|
|
public ICollection<SubmissionDetail> SubmissionDetails { get; set; }
|
|
public AssignmentGroup AssignmentGroup { get; set; }
|
|
|
|
public AssignmentQuestion()
|
|
{
|
|
Id = Guid.NewGuid();
|
|
SubmissionDetails = new HashSet<SubmissionDetail>();
|
|
}
|
|
}
|
|
}
|