Ejemplo n.º 1
0
 /// <summary>
 /// Loads the entire table of users and nicknames into the cache.
 /// </summary>
 public void LoadUsersIntoCache()
 {
     ipAddressToViewUserCache = Nicknames.AsNoTracking().ToDictionary(n => n.IpAddress, n => new ChatMessageViewUser
     {
         Username  = n.Name,
         ChatColor = DefaultChatColor,
         LoggedIn  = false
     });
     userIdToViewUserCache = Users.AsNoTracking().ToDictionary(u => u.Id, u => new ChatMessageViewUser
     {
         Username  = u.UserName,
         ChatColor = u.ChatColor,
         LoggedIn  = true
     });
 }
Ejemplo n.º 2
0
 private string GetNameForIpAddress(string ipAddress) =>
 Nicknames.AsNoTracking().FirstOrDefault(n => n.IpAddress == ipAddress)?.Name ?? ipAddress;