'EF Core - what about database initializers?

In EF 6 we used database initializers for the following reasons:

  • Seeding data
  • Using seeding to define indices
  • Using seeding to define the database collation
  • Using seeindg to set "sparse"
  • Deciding on the action if the database model does not match (e.g., drop-and-recreate or create-if-not-exists)

Seeding and indices can now be defined in OnModelCreating, however, I still need a hook to execute raw SQL commands to define the database collation and set "sparse" - how to do that in EF Core?

What decides in EF Core which "initialization strategy" (e.g., drop-and-recreate) is performed when connection to the database? There does not seem to be a replacement for this at all?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source