I am using Entity Framework code-first and I call edit user, inside edit user I call a stored procedure that is editing the user. After that, I call another method to get the user from the database.
The problem is that this method returns the old user so I think I need to refresh the context before calling the second method. How I can refresh the context in Entity Framework?
Based on this page: Entity Framework Refresh context?
I try to use this:
yourContext.Entry(yourEntity).Reload();
but I'm not sure how to do this exactly.
This is my context:
var newUser = await authenticationContext.Users.Where(u => u.Email == "user1@test.com").FirstOrDefaultAsync();
I tried:
authenticationContext.Entry(authenticationContext.Users).Reload();
but it is throwing an error.
System.InvalidOperationException: the entity type Dbset is not part of the model for the current context.