Answer the question
In order to leave comments, you need to log in
ASP.NET how to cache variable in header?
Each time a request is made, a selection is made in the header again, and, accordingly, operations on the page are performed on it.
As an example:
@{
var users = context.Users.Where(x => x.Status != null).ToList();
}
Answer the question
In order to leave comments, you need to log in
Try something like this.
When the collection changes, call UserStatus.Instance.UserChanged(users);
public class UserStatus{
public static UserStatus Instance => _instance;
public IList<User> Users => getUsers();
public void UserChanged( IList<User> users){
///
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question