我不知道如何在C#/ Net Core 2.2中获得此数据结构

时间:2019-11-25 13:50:36

标签: angular .net-core graphql ag-grid

数据结构为:

fileName: {filterType: "text", type: "contains", filter: "a"}

如果数据结构如下:

0: {colId: "callDateTime", sort: "asc"}

我在c#中得到了这样的信息:

var sortings = ctx.GetArgument<List<SortModel>>("sorting");
  

我正在使用带有ag-grid和.net core 2.2的graphQl

消息错误:

  

变量'$ filterModel [0]'无效。无法将输入解析为   “ FilterModel”类型。您是否提供了列表或标量值   不小心?

在graphQL中查询(Angular 7):

    const query = (request, columns) => {
       console.log(request);
       const fields = columns.map(col => col.field);
       console.log(request.filterModel);
       console.log(request.sortModel);

    return {
       query: gql`
       query GetRows(
          $start: Int,
          $end: Int,
          $sortModel: [SortModel],
          $groups: [RowGroup],
          $values: [Value],
          $groupKeys: [String],
          $filterModel: [FilterModel]
       ) {
          rows(
             startRow: $start,
             endRow: $end,
             sorting: $sortModel,
             rowGroups: $groups,
             values: $values,
             groupKeys: $groupKeys,
             filterModel: $filterModel
          ) {
             ${fields}
          }
       }`,
       variables: {
          start: request.startRow,
          end: request.endRow,
          sortModel: request.sortModel,
          groups: request.rowGroupCols,
          values: request.valueCols,
          groupKeys: request.groupKeys,
          filterModel: request.filterModel  
       },  
    }

我尝试过类似的操作:

var filterModel = ctx.GetArgument<IDictionary<string, FilterModel>>("filterModel");

0 个答案:

没有答案