Created
August 15, 2021 10:24
-
-
Save executeautomation/f6e2f39aeb46525b67854a524c2b68b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (args.Length == 1 && args[0].ToLower() == "seeddata") | |
SeedData(app); | |
//Seed Data | |
void SeedData(IHost app) | |
{ | |
var scopedFactory = app.Services.GetService<IServiceScopeFactory>(); | |
using (var scope = scopedFactory.CreateScope()) | |
{ | |
var service = scope.ServiceProvider.GetService<DataSeeder>(); | |
service.Seed(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello I reading your article
https://medium.com/executeautomation/seeding-data-using-ef-core-in-asp-net-core-6-0-minimal-api-d5f6ecdb350c
I want to know line 2. why it can get app where app you declare.