OData分组实体

时间:2019-05-31 06:59:13

标签: asp.net-core odata

我正在尝试使用以下网址

  • root->A_file1 ->B_dir->C_dir ->C_file1 ->C_file2 ->.... ->C_fileN ->f1.txt ->f2.txt ->f3.txt
  • v1/$metadata
  • v1/se/companies
  • v1/se/addresses
  • v1/no/companies

但是,如果我使用v1/no/addresses,则会出现以下错误

[ODataRoutePrefix("se/Companies")]

是否可以通过某种方式添加带有System.InvalidOperationException: The path template 'se/Companies({companyNumber})' on the action 'Get' in controller 'SwedishCompany' is not a valid OData path template. Resource not found for the segment 'se'. at Microsoft.AspNet.OData.Routing.Conventions.AttributeRoutingConvention.GetODataPathTemplate(String prefix, String pathTemplate, IServiceProvider requestContainer, String controllerName, String actionName) at Microsoft.AspNet.OData.Routing.Conventions.AttributeRoutingConvention.<>c__DisplayClass11_0.<GetODataPathTemplates>b__1(ODataRouteAttribute route) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext() at Microsoft.AspNet.OData.Routing.Conventions.AttributeRoutingConvention.BuildAttributeMappings(IEnumerable`1 controllerActions) at Microsoft.AspNet.OData.Routing.Conventions.AttributeRoutingConvention.get_AttributeMappings() at Microsoft.AspNet.OData.Routing.Conventions.AttributeRoutingConvention.SelectAction(RouteContext routeContext) at Microsoft.AspNet.OData.Routing.ODataActionSelector.SelectCandidates(RouteContext context) at Microsoft.AspNetCore.Mvc.Internal.MvcRouteHandler.RouteAsync(RouteContext context) at Microsoft.AspNetCore.Routing.Route.OnRouteMatched(RouteContext context) at Microsoft.AspNetCore.Routing.RouteBase.RouteAsync(RouteContext context) at Microsoft.AspNetCore.Routing.RouteCollection.RouteAsync(RouteContext context) at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application) 的前缀?

0 个答案:

没有答案