Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Database Seeding Implementation for EF Core 9 Compatibility #1293

Open
Kamyab7 opened this issue Jan 14, 2025 · 0 comments
Open

Update Database Seeding Implementation for EF Core 9 Compatibility #1293

Kamyab7 opened this issue Jan 14, 2025 · 0 comments

Comments

@Kamyab7
Copy link

Kamyab7 commented Jan 14, 2025

Is your feature request related to a problem? Please describe.
Currently, the project uses the old seeding mechanism for database initialization and seeding. With the introduction of EF Core 9, there is a new UseAsyncSeeding method that provides a more efficient way to handle asynchronous database seeding. The current seeding logic does not take full advantage of these new capabilities.

Describe the solution you'd like
Refactor the database seeding logic to utilize the new UseAsyncSeeding method introduced in EF Core 9. Specifically, I would like to:

  • Implement an AddAsyncSeeding extension method to configure the DbContextOptionsBuilder for async seeding.
  • Refactor the ApplicationDbContextInitialiser to work with the new async seeding approach.
  • Ensure that default roles, users, and any necessary data (e.g., TodoList and TodoItem) are seeded correctly using the new method.
  • Update the AddDbContext configuration to use AddAsyncSeeding for all supported database providers (PostgreSQL, SQLite, and SQL Server).

Describe alternatives you've considered
An alternative would be to keep the current seeding mechanism and not update it for EF Core 9, but this would mean missing out on the performance and scalability improvements that come with async seeding.

Additional context
EF Core 9 introduces new features that allow for more efficient asynchronous workflows. Leveraging UseAsyncSeeding will ensure the seeding process is non-blocking and scales better with larger datasets. This change will also improve maintainability and clarity in the codebase by clearly separating database initialization and seeding logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant