Answer the question
In order to leave comments, you need to log in
Entity Framework Code First, database creation problem, what should I do?
I have classes:
public class Topic
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public DateTime Time { get; set; }
public List<Lesson> Lessons { get; set; }
public List<string> Tags { get; set; }
public Topic()
{
Lessons = new List<Lesson>();
Tags = new List<string>();
}
}
public class Lesson
{
public int Id { get; set; }
public int TopicId { get; set; }
public Topic Topic { get; set; }
public string Name { get; set; }
public List<Paragraph> Paragraphs { get; set; }
public List<LTask> Tasks { get; set; }
public Lesson()
{
Paragraphs = new List<Paragraph>();
Tasks = new List<LTask>();
}
}
public class LTask
{
public int Id { get; set; }
public int LessonId { get; set; }
public Lesson Lesson { get; set; }
public string HeadLine { get; set; }
public string Question { get; set; }
public string Answer { get; set; }
}
public class Paragraph
{
public int Id { get; set; }
public int LessonId { get; set; }
public Lesson Lesson { get; set; }
public string HeadLine { get; set; }
public string Text { get; set; }
}
public class CourseContext : DbContext
{
public CourseContext()
: base("name=CourseContext")
{
}
public DbSet<Topic> Topics { get; set; }
public DbSet<string> Tags { get; set; }
public DbSet<Lesson> Lessons { get; set; }
public DbSet<Paragraph> Paragraphs { get; set; }
public DbSet<LTask> Tasks { get; set; }
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question