Open Mech0z opened 6 years ago
@Mech0z your sequence it's nice, but you need to use this project: https://github.com/alextochetto/aspnetcore-identity-mongodb
I cloned your sample project and got it compiling and running but I cant do as said in the readme
` public class HomeController : Controller
{
private readonly IServiceProvider _provider;
public HomeController(IServiceProvider provider)
{
_provider = provider;
}
public async Task<IActionResult> Index()
{
var userManager = _provider.GetService<UserManager<IdentityUser>>();
var result = await userManager.Users.ToListAsync();
return View();
}`
If I do, then userManager is null and I get an exception when I call userManager.Users
https://github.com/Mech0z/Foosball/blob/master/FoosballService/Controllers/HomeController.cs
@Mech0z did you create an account at mLab or any other mongodb server? Did you change the connection string in appsettings.json file configuration?
Yes I just use a test databse https://github.com/Mech0z/Foosball/tree/master/FoosballService and I can create a user and login just fine, I just cant do these commands which are in the Readme.md
var userManager = provider.GetService<UserManager<IdentityUser>>();
var roleManager = provider.GetService<RoleManager<IdentityRole>>();
I cant seem to find the commits that should help me set this up The only change thing I can see you have done is
But when I run this I get