I have following database schema and I would like to seed the data in the database but I could not understand how to seed the images at first go, what should be in the table entity.
I need help to know where I need changes.
Thanks.
I have following database schema and I would like to seed the data in the database but I could not understand how to seed the images at first go, what should be in the table entity.
I need help to know where I need changes.
Thanks.
Since you referenced Core, here's the easiest way (in Program.Main)
try
{
var host = BuildWebHost(args);
using (var scope = host.Services.CreateScope())
{
var services = scope.ServiceProvider;
try
{
var context = services.GetRequiredService<myContext>();
DbInitializer.Seed(context);
}
catch
{
throw;
}
}
host.Run();
}
catch
{
throw;
}
and create a class called DbInitializer with a method Seed that takes an EF context. I think you can take it from there.
(and don't post images of code, post the code using Ctrl+K to format code-blocks)