示例#1
0
        public async IAsyncEnumerable <CommentViewModel> GetAllAsync(uint gameId, uint modId, [EnumeratorCancellation] CancellationToken ct = default)
        {
            var game = await _nexusModsGameQueries.GetAsync(gameId, ct);

            if (game is null)
            {
                yield break;
            }
            var gameDomain = game.DomainName;
            var gameName   = game.Name;

            var mod = await _nexusModsModQueries.GetAsync(gameDomain, modId, ct);

            if (mod is null)
            {
                yield break;
            }
            var modName = mod.Name;

            var threadViewModel = await _nexusModsThreadQueries.GetAsync(gameId, modId, ct);

            if (threadViewModel is null)
            {
                yield break;
            }
            var threadId = threadViewModel.ThreadId;

            var key = $"comments({gameId}, {modId}, {threadId})";

            if (!_cache.TryGetValue(key, _jsonSerializer, out CommentViewModel[]? cacheEntry))
 public async Task <IActionResult> GetThreadAsync([FromQuery, BindRequired] uint gameId, [FromQuery, BindRequired] uint modId, [FromServices] IThreadQueries threadQueries, CancellationToken ct) =>
 Ok(await threadQueries.GetAsync(gameId, modId, ct));