I got this error, but im unable to determine what is the real cause, therefore im unable to fix it? "Entity Framework Core: A second operation started on this context before a previous operation completed"
The context
private readonly ApplicationDbContext _context;
public MyController(ApplicationDbContext context)
{
_context = context;
}
The error occurs here "await _context.SaveChangesAsync();", however this statement is executed only once.
//Find user by Id
var foundUser = await _context.Users.FindAsync(myUserId);
//Populate myUserData here
....
//If user not found, create the user
if (foundUser == null)
{
_context.Users.Add(myUserData);
await _context.SaveChangesAsync(); //<--------ERROR HERE!
}
_contextdisposed? - Eric J.