37 lines
1002 B
C#
37 lines
1002 B
C#
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace Entities.Contracts
|
|
{
|
|
[Table("subjects")]
|
|
public class Subject
|
|
{
|
|
[Key]
|
|
[Column("id")]
|
|
public Guid Id { get; set; }
|
|
|
|
[Column("name")]
|
|
[MaxLength(20)]
|
|
public string Name { get; set; }
|
|
|
|
[Column("description")]
|
|
public string Description { get; set; }
|
|
|
|
[InverseProperty(nameof(QuestionType.Subject))]
|
|
public virtual IEnumerable<QuestionType> QuestionTypes { get; set; }
|
|
|
|
[InverseProperty(nameof(Question.Subject))]
|
|
public virtual IEnumerable<Question> Questions { get; set; }
|
|
|
|
[InverseProperty(nameof(User.TeachSubject))]
|
|
public virtual IEnumerable<User> SubjectTeachers { get; set; }
|
|
public Subject()
|
|
{
|
|
Id = Guid.NewGuid();
|
|
QuestionTypes = new HashSet<QuestionType>();
|
|
Questions = new HashSet<Question>();
|
|
}
|
|
}
|
|
}
|