struct&&assiQues
This commit is contained in:
36
Entities/Contracts/Textbook/KeyPoint.cs
Normal file
36
Entities/Contracts/Textbook/KeyPoint.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Entities.Contracts
|
||||
{
|
||||
[Table("key_point")]
|
||||
public class KeyPoint
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[StringLength(255)]
|
||||
public string Key { get; set; } = string.Empty;
|
||||
|
||||
|
||||
[Required]
|
||||
public Guid LessonID { get; set; }
|
||||
|
||||
[ForeignKey(nameof(LessonID))]
|
||||
public Lesson Lesson { get; set; }
|
||||
|
||||
|
||||
public ICollection<Question> Questions { get; set; }
|
||||
|
||||
public KeyPoint()
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
Questions = new HashSet<Question>();
|
||||
}
|
||||
}
|
||||
}
|
48
Entities/Contracts/Textbook/Lesson.cs
Normal file
48
Entities/Contracts/Textbook/Lesson.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Entities.Contracts
|
||||
{
|
||||
[Table("lesson")]
|
||||
public class Lesson
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[StringLength(255)]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public Guid TextbookID { get; set; }
|
||||
|
||||
|
||||
[ForeignKey(nameof(TextbookID))]
|
||||
public Textbook Textbook { get; set; }
|
||||
|
||||
[InverseProperty(nameof(KeyPoint.Lesson))]
|
||||
public ICollection<KeyPoint>? KeyPoints { get; set; }
|
||||
|
||||
[InverseProperty(nameof(Question.Lesson))]
|
||||
public ICollection<Question>? Questions { get; set; }
|
||||
|
||||
[InverseProperty(nameof(LessonQuestion.Lesson))]
|
||||
public ICollection<LessonQuestion>? LessonQuestions { get; set; }
|
||||
|
||||
|
||||
|
||||
public Lesson()
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
KeyPoints = new HashSet<KeyPoint>();
|
||||
Questions = new HashSet<Question>();
|
||||
LessonQuestions = new HashSet<LessonQuestion>();
|
||||
}
|
||||
}
|
||||
}
|
32
Entities/Contracts/Textbook/LessonQuestion.cs
Normal file
32
Entities/Contracts/Textbook/LessonQuestion.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Entities.Contracts
|
||||
{
|
||||
[Table("lesson_question")]
|
||||
public class LessonQuestion
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[MaxLength(65535)]
|
||||
public string Question { get; set; }
|
||||
|
||||
[Required]
|
||||
public Guid LessonID { get; set; }
|
||||
|
||||
[ForeignKey(nameof(LessonID))]
|
||||
public Lesson Lesson { get; set; }
|
||||
|
||||
public LessonQuestion()
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
36
Entities/Contracts/Textbook/Textbook.cs
Normal file
36
Entities/Contracts/Textbook/Textbook.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Entities.Contracts
|
||||
{
|
||||
[Table("textbook")]
|
||||
public class Textbook
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public Grade Grade { get; set; } = Grade.Unknown;
|
||||
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
public Publisher Publisher { get; set; } = Publisher.部编版;
|
||||
|
||||
public SubjectAreaEnum SubjectArea { get; set; } = SubjectAreaEnum.Unknown;
|
||||
|
||||
[InverseProperty(nameof(Lesson.Textbook))]
|
||||
public ICollection<Lesson> Lessons { get; set; }
|
||||
|
||||
public Textbook()
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
Lessons = new HashSet<Lesson>();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user