public void Init() { // init repository this._dbContext = new ApplicationDbContext(); this._chatRepository = new ChatRepository(this._dbContext); this._friendRepository = new FriendRepository(this._dbContext); this._privateMessageRepository = new PrivateMessageRepository(this._dbContext); this._statusRepository = new StatusRepository(this._dbContext); this._statusMessageRepository = new StatusMessageRepository(this._dbContext); this._statusLocationRepository = new StatusLocationRepository(this._dbContext); this._statusImageRepository = new StatusImageRepository(this._dbContext); this._likeRepository = new LikeRepository(this._dbContext); this._shareRepository = new ShareRepository(this._dbContext); this._commentRepository = new CommentRepository(this._dbContext); this._newFeedRepository = new NewFeedsRepository(this._dbContext); // get current connectionId this._curConnectionId = this.Context.ConnectionId; // get chatViewModel of User via connectionId this._curUserChat = this._chatRepository.GetUserByConnectionId(ConnectedUsers, this.Context.ConnectionId); // get friendListId this._friendListId = this._friendRepository.GetFriendListId(this._curUserChat.UserId).ToList(); // get friendListOnline this._friendListOnline = this._chatRepository.GetFriendListOnline(ConnectedUsers, this._friendListId, this._curUserChat.UserId); // get friendListConnectionId this._friendListConnectionId_Online = this._chatRepository.GetFriendList_ConnectionId(this._friendListOnline); this._allUserRelate_ConnectionId = this._chatRepository.GetAllUserRelate_ConnectionId(this._friendListConnectionId_Online, this._curUserChat.ConnectionId); }