✅ EF Core Seeders
How do I handle seeders in EF Core? Is there a way to split seeders away from migrations? Currently .HasData creates the insert in the migration
13 Replies
Is there any better way?
What is your version of EFCore?
I recently wrote a service to do this, i ripped the data out of our migrations
I used this to do it on api startup
Extensions.Hosting.AsyncInitialization 1.0.0
A simple helper to perform async application initialization for the generic host in .NET Core 2.1 or higher.
7.0
ty gonna check it out
Then look for docs, there should be method Seed()
Data Seeding - EF Core
Using data seeding to populate a database with an initial set of data using Entity Framework Core
I read this
and it's not what I'm looking for
it puts it in migrations
No, there should be another way
Stack Overflow
How to seed data in .NET Core 6 with Entity Framework?
I know how to seed data to a database with old .NET 5.0 in startup.cs file using my Seeder class with a Seed() method creating some initial data.
public void Configure(IApplicationBuilder app,
@barcode
Yes this is what i was describing above using AsyncInitialization
But you have to write it urself
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.