C
C#3y ago
Gage

❔ Converting ASP.NET 6 to ASP.NET 5

I posted an image of the code I am trying to convert. To put some context behind it, its in configure services and its purpose is to create seed users. Seems a lot like services.addScoped.
3 Replies
Gage
GageOP3y ago
var context = services.BuildServiceProvider().GetService<ApplicationDbContext>();
context.Database.Migrate();

var userManager = services.BuildServiceProvider().GetService<UserManager<IdentityUser>>();
var roleManager = services.BuildServiceProvider().GetService<RoleManager<IdentityRole>>();

IdentitySeedData.Initialize(context, userManager, roleManager).Wait();
services.AddRazorPages();
var context = services.BuildServiceProvider().GetService<ApplicationDbContext>();
context.Database.Migrate();

var userManager = services.BuildServiceProvider().GetService<UserManager<IdentityUser>>();
var roleManager = services.BuildServiceProvider().GetService<RoleManager<IdentityRole>>();

IdentitySeedData.Initialize(context, userManager, roleManager).Wait();
services.AddRazorPages();
fair?
qqdev
qqdev3y ago
Can’t you just use .NET 6/7?
Accord
Accord3y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server