protected override async Task AddUserTokenAsync(IdentityUserToken <TKey> token) { token.ThrowIfNull(nameof(token)); UserTokens ??= (await UserTokensTable.GetTokensAsync(token.UserId)).ToList(); UserTokens.Add(token); }
/// <summary> /// Add a new user token. /// </summary> /// <param name="token">The token to be added.</param> /// <returns></returns> protected override Task AddUserTokenAsync(UserToken token) { UserTokens.Add(token); return(Task.CompletedTask); }
protected override Task AddUserTokenAsync(IdentityUserToken <Guid> token) { UserTokens.Add(token); return(Task.CompletedTask); }
/// <inheritdoc /> protected override async Task AddUserTokenAsync(TUserToken token) { token.ThrowIfNull(nameof(token)); UserTokens ??= (await UserTokensRecord.GetTokensAsync(token.UserId)).ToList(); UserTokens.Add(token); }
} //not fully consistant, as the key is duplicated in every add token info, but do this due to perfromance (but avoid separate class which is very close to AddTokenInfo) #endregion #region Methods #region Notify /// <summary> /// Handles parse-notification. This method is called during the parsing-process when reaching specified positions in the grammar file. /// </summary> /// <param name="position">The reached position.</param> /// <param name="addInfo">Additional information about the reached position.</param> partial void Notify(int position) { //do nothing when it's not needed (normal coco-codegeneration, no code-completion request) if (!customizedParsing) { return; } //if it was a charset, token, productioni or the name of the grammar, store the additional information if (position == 2 && !string.IsNullOrEmpty(la.val)) { GrammarName = la.val; } else if (position == 5 && !string.IsNullOrEmpty(la.val)) { UserCharSets.Add(new AddTokenInfo(la.val, la.line, la.col)); currentContext = la.val; } else if (position == 10 && !string.IsNullOrEmpty(t.val)) { UserTokens.Add(new AddTokenInfo(t.val, t.line, t.col)); currentContext = t.val; } else if (position == 25 && !string.IsNullOrEmpty(la.val)) { UserProductions.Add(new AddTokenInfo(la.val, la.line, la.col)); currentContext = la.val; } else if (position == 50 && !string.IsNullOrEmpty(la.val)) { AddReference(la.val, la.line, la.col, currentContext); } if (errors.count > 0) { //grammar must be free of errors until target point (otherwise, it's dangerous that a wrong completion-point gets detected) return; } if (t.line < TargetLine || (t.line == TargetLine && t.col < TargetCol)) { //add opened brace (only as long as the current position is before the target position) if (position == 12 || position == 30) { AddOpenBrace((long)CocoToken.LPar); } else if (position == 13 || position == 33) { RemoveOpenBrace((long)CocoToken.LPar); } else if (position == 14 || position == 31) { AddOpenBrace((long)CocoToken.LBrack); } else if (position == 15 || position == 34) { RemoveOpenBrace((long)CocoToken.LBrack); } else if (position == 16 || position == 32) { AddOpenBrace((long)CocoToken.LBrace); } else if (position == 17 || position == 35) { RemoveOpenBrace((long)CocoToken.LBrace); } DeterminedGrammarPos = position; } }