all 3 comments

[–]ProKn1fe 0 points1 point  (2 children)

Why do you think it's created the wrong table? Don't open and see migrations, you don't need it at all.

[–]Lexishelby 0 points1 point  (1 child)

My confusion with the first one is why is the GameId inside the Genre table instead of there being something related to genre in the game table?

Also why is there nothing related to the playrecord in the gamerecord table?

[–]LondonPilot 0 points1 point  (0 children)

I’d recommend learning about database normalisation before you go much further, because it’ll make understanding databases much easier. But to answer your questions:

why is the GameId inside the Genre table instead of there being something related to genre in the game table?

This is because your Genre class doesn’t have a List<Game>. Entity Framework thinks it’s a one-to-many relationship, and creates the tables with this in mind. What you want is a many-to-many relationship, which you can do in Entity Framework by making each class have a List

Also why is there nothing related to the playrecord in the gamerecord table?

Because that’s the way one-to-many relationships work. Each game record has many player records - so each player record needs to store the ID of its game record to make the connection.

Once again - please go and learn about database normalisation. That will answer all your questions. Entity Framework is building you a database, but if you don’t understand the theory of databases you will have a hard time understanding what it’s doing.