简体   繁体   English

Restier asp.net中如何有两个以上的扩展

[英]How have more than two expands in restier asp.net

I have a RESTier service and I need to use more than two expand in browser Url like below: 我有一个RESTier服务,需要在浏览器网址中使用两个以上的扩展,如下所示:

http://localhost:64747/api/SI24/Customers?$filter=Id%20eq%2067922&$expand=Bns($expand=Parvandes($expand=ParvandeStateLogs))

I must not make any controller for this service. 我不得为此服务设置任何控制器。 If you see in my url you can understand that I must navigate between four tables. 如果您在我的网址中看到,则可以理解我必须在四个表之间导航。 The tables are Customers , Bns , Parvandes , ParvandeStateLogs. 这些表是Customer,Bns,Parvandes,ParvandeStateLogs。 How can I solve this problem? 我怎么解决这个问题?

I myself against my will decided to make one controller for this query and added the attribute of "[EnableQuery(MaxExpansionDepth = 50)]" over its action as below: 我本人违背我的意愿,决定为此查询创建一个控制器,并在其操作上添加了“ [EnableQuery(MaxExpansionDepth = 50)]”属性,如下所示:

public class CustomersController : ODataController
{
    private SI24 db = new SI24();

    // GET: api/Customers
    [EnableQuery(MaxExpansionDepth = 50)]
    public IQueryable<Customer> GetCustomers()
    {
        return db.Customers;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM