コード例 #1
0
 private void CreateNewUserSession(string userId, string connectionId)
 {
     UserCredential currentCred = new UserCredential
     {
         ConnectionStatus = ConnectionStatus.Connected,
         UserId = userId
     };
     currentCred.Sessions.Add(new ConnectionSession
     {
         ConnectionId = connectionId,
         ConnectedTime = DateTime.Now.Ticks,
         DisconnectedTime = 0L,
         ParentUser = currentCred
     });
     _connections.Add(userId, currentCred);
 }
コード例 #2
0
 private static void ExpireSession(UserCredential currentCred)
 {
     ConnectionSession currentSession =
         currentCred.Sessions.Find(sess =>
             sess.DisconnectedTime == 0);
     if (currentSession != null
         && currentSession.DisconnectedTime == 0)
     {
         currentSession.DisconnectedTime = DateTime.Now.Ticks;
     }
 }