【发布时间】:2015-05-16 23:37:58
【问题描述】:
我有一个现有的数据库,其中包含 3 个表和它们之间的关系。其中两个表具有名为“Id”的主键列,它们是整数列。第三个表有一个复合主键,它由与其他两个表(链接表或多对多)中的每一个相关的外键组成。
我设置了一个新的 Azure 移动服务并将此数据库指定为服务数据的来源。我为 .NET 中的服务构建了控制器、模型和数据对象 (DTO)。一切看起来都正确,但是当我尝试从任何表中请求数据时,我收到了这个错误:
{
message: "The query specified in the URI is not valid. Property 'Id' is of an unrecognized EdmPropertyKind."
exceptionMessage: "Property 'Id' is of an unrecognized EdmPropertyKind."
exceptionType: "Microsoft.Data.OData.ODataException"
stackTrace: " at Microsoft.Data.OData.Query.SyntacticAst.SelectPathSegmentTokenBinder.TryBindAsDeclaredProperty(PathSegmentToken tokenIn, IEdmEntityType entityType, ODataPathSegment& segment) at Microsoft.Data.OData.Query.SyntacticAst.SelectPathSegmentTokenBinder.ConvertNonTypeTokenToSegment(PathSegmentToken tokenIn, IEdmModel model, IEdmEntityType entityType) at Microsoft.Data.OData.Query.SyntacticAst.SelectPropertyVisitor.ProcessTokenAsPath(NonSystemToken tokenIn) at Microsoft.Data.OData.Query.SyntacticAst.SelectPropertyVisitor.Visit(NonSystemToken tokenIn) at Microsoft.Data.OData.Query.SyntacticAst.NonSystemToken.Accept(IPathSegmentTokenVisitor visitor) at Microsoft.Data.OData.Query.SyntacticAst.SelectBinder.Bind(SelectToken tokenIn) at Microsoft.Data.OData.Query.SelectExpandSemanticBinder.Parse(IEdmEntityType elementType, IEdmEntitySet entitySet, ExpandToken expandToken, SelectToken selectToken, ODataUriParserConfiguration configuration) at Microsoft.Data.OData.Query.ODataUriParser.ParseSelectAndExpandImplementation(String select, String expand, IEdmEntityType elementType, IEdmEntitySet entitySet) at System.Web.Http.OData.Query.SelectExpandQueryOption.get_SelectExpandClause() at System.Web.Http.OData.Query.Validators.SelectExpandQueryValidator.Validate(SelectExpandQueryOption selectExpandQueryOption, ODataValidationSettings validationSettings) at System.Web.Http.OData.Query.SelectExpandQueryOption.Validate(ODataValidationSettings validationSettings) at System.Web.Http.OData.Query.Validators.ODataQueryValidator.Validate(ODataQueryOptions options, ODataValidationSettings validationSettings) at System.Web.Http.OData.Query.ODataQueryOptions.Validate(ODataValidationSettings validationSettings) at System.Web.Http.OData.EnableQueryAttribute.ValidateQuery(HttpRequestMessage request, ODataQueryOptions queryOptions) at System.Web.Http.OData.EnableQueryAttribute.ExecuteQuery(Object response, HttpRequestMessage request, HttpActionDescriptor actionDescriptor) at System.Web.Http.OData.EnableQueryAttribute.OnActionExecuted(HttpActionExecutedContext actionExecutedContext)"
}
有谁知道我做错了什么?
【问题讨论】:
标签: .net azure-mobile-services