How can you apply data seeding to a specific entity in Entity Framework Core?

  • Use the AddData() method in the OnModelCreating method of the DbContext class
  • Use the ApplyData() method in the ConfigureServices method of the Startup class
  • Use the HasData() method in the OnModelCreating method of the DbContext class
  • Use the SeedData() method in the ConfigureServices method of the Startup class
In Entity Framework Core, data seeding is typically applied using the HasData() method within the OnModelCreating method of the DbContext class. This method allows you to specify initial data for entities, ensuring that it gets inserted into the database when the database is created or migrated.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *