我无法让 groupby 与 top 和 skip 一起工作,这应该是最简单的事情。我正在使用 OData 获取数据并能够使用下面的查询获取输出
https://localhost:6523/api/OData/AssetUsage/ ?$apply=groupby((assetId,BIAsset/name),aggregate(interactions with sum as totalInteractions, uniqueInteractions with sum as totalUniqueInteractions))&$orderBy=totalInteractions asc
但是,当我尝试在上面生成的输出上应用 skip 或 top 时,我收到下面提到的错误
https://localhost:6523/api/OData/AssetUsage/ ?$apply=groupby((assetId,BIAsset/name),aggregate(interactions with sum as totalInteractions, uniqueInteractions with sum as totalUniqueInteractions))&$orderBy=totalInteractions asc&$顶部=1
错误-
message": "URI 中指定的查询无效。在“Portal.Models.Entities.AssetUsage”类型上找不到名为“BIAsset”的属性。",
“内在错误”:
-"message": "在类型 'Portal.Models.Entities.AssetUsage' 上找不到名为 'Asset' 的属性。",
-“类型”:“Microsoft.OData.ODataException”,
实体类结构
public class AssetUsage
{
public int Id { get; set; }
[ForeignKey("BIAsset")]
public int? AssetId { get; set; }
public int YearMonthId { get; set; }
public int Interactions { get; set; }
public int UniqueInteractions { get; set; }
public DateTimeOffset Recency { get; set; }
public virtual BIAsset BIAsset { get; set; }
}