コード例 #1
0
        private static async Task <object> ResolveConnectionAsync(IMediator mediator, IResolveConnectionContext <DynamicProperty> context)
        {
            int.TryParse(context.After, out var skip);

            var query = context.GetDynamicPropertiesQuery <SearchDynamicPropertyDictionaryItemQuery>();

            query.PropertyId = context.Source.Id;
            query.Skip       = skip;
            query.Take       = context.First ?? context.PageSize ?? 10;
            query.Sort       = context.GetArgument <string>("sort");
            query.Filter     = context.GetArgument <string>("filter");

            context.CopyArgumentsToUserContext();

            var response = await mediator.Send(query);

            return(new PagedConnection <DynamicPropertyDictionaryItem>(response.Results, query.Skip, query.Take, response.TotalCount));
        }