0

I use entity framework for first time ,use database first. I add the database in my application and don't to any thing except display data. My database has tables "Bus, Student, Gender, Course" after first run, I shoked that there is another tables created in the database like"Buses, courses, students, genders, Migration history". What is these tables and how it created?

Marcus Höglund
  • 16,172
  • 11
  • 47
  • 69
Hoda Osama
  • 13
  • 1
  • 10

1 Answers1

1

You said you are using Database First approach. But you mentioned that you could see Migration History table in the database. This is not supposed to happen.

  1. Database First approach doesn't support Migrations. It's only for Code First Approach. You are doing something seriously wrong w.r.t setting up EF in your project.

  2. Code First approach creates tables in the plural naming from based on the Models you created. So you have models for Bus, Student, Gender, Course . Hence it created Buses, Students, Genders, Courses. It is Code First Approach.

First you need to get basic understanding of Entity Framework then you can decide which approach to use as per your requirements. You are mixing both approaches and which doesn't work.

https://www.asp.net/mvc/overview/getting-started/database-first-development/setting-up-database

Venkata Dorisala
  • 4,783
  • 7
  • 49
  • 90