【发布时间】:2020-05-22 11:34:18
【问题描述】:
我使用IQueryable 公开我的“示例”类并应用[UseSorting] 属性,以便用户可以定义结果的排序顺序。这很好用,而且 Playground 允许我这样做。
public class QueryType : ObjectType
{
[UseSorting]
public IQueryable<Example> GetExamples([Service]IExampleRepository repository)
{
return repository.GetExamples();
}
}
public class ExampleType : ObjectType<Example>
{
protected override void Configure(IObjectTypeDescriptor<Example> descriptor)
{
}
}
但是“Example”类有三个属性,我只希望用户可以订购其中的两个。用户按第三个属性订购是没有意义的。如何指定要从排序中间件中排除的“示例”属性之一?
【问题讨论】:
标签: sorting graphql hotchocolate