I have a very frustrating issue. I'm making an application with ASP.NET, and have a database with tables already set up and working. I have a SeedData.cs file to seed my database. When I run dotnet ef run the application builds properly and the seeder file runs with no issues...

But my database tables are still empty. They aren't showing any of the seeded data.. There are no errors being given, what could I possibly be doing wrong? Any help would be GREATLY appreciated. Thank you.

closed as off-topic by Ian Kemp, eyllanesc, Stephen Rauch, tripleee, Vega Mar 12 at 7:18

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Ian Kemp, eyllanesc, Stephen Rauch, tripleee, Vega
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Need to post your code, pretty hard to tell without seeing what you've done. First guess would be that you didn't call the SaveChanges() method on your database context. – kilkfoe Mar 12 at 2:00

Are you creating a database first and then seeding it with data? Or the database has been created and you are just seeding data?

If you are doing code first migration you will need to run these commands in package manager console.

Add-Migration Initial Update-Database

If just data, you might not be commiting your transaction (i.e call SaveChanges() method.

Not the answer you're looking for? Browse other questions tagged or ask your own question.