Пример #1
0
        public async Task ExecuteAsync(QueryContext context)
        {
            _repo.Apply(context.Descriptor, context.Params);
            var condition = new Condition();

            Utils.Map(context.Descriptor, context.Params, condition);
            if (!string.IsNullOrEmpty(context.Params.Exclude))
            {
                object[] id;
                try
                {
                    id = _repo.ParseId(context.Params.Exclude);
                }
                catch (Exception ex)
                {
                    throw new QueryException("id format incorrect", QueryErrorCode.BadRequest, ex);
                }

                var result = await _repo.ExistsAsync(condition, id, context.CancellationToken);

                context.Succeed(result);
            }
            else
            {
                var result = await _repo.ExistsAsync(condition, context.CancellationToken);

                context.Succeed(result);
            }
        }