简体   繁体   English

IPP .NET c#SDK允许查询过滤器,但这不会减少有效负载吗?

[英]IPP .NET c# SDK allows query filters, but this does not reduce payload?

Referencing the following IPP Documentation: 参考以下IPP文档:

https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/0150_ipp_.net_devkit_3.0/query_filters https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/0150_ipp_.net_devkit_3.0/query_filters

I made the assumption that the following code using the Linq Extentions Projection would alter the request and reduce the payload of the response by only querying for the requested fields and only including those fields (narrow result set) in the response: 我假设使用Linq Extensions Projection的以下代码将仅通过查询所请求的字段并且仅在响应中包括那些字段(窄结果集)来更改请求并减少响应的有效负载:

public List<ShortAccount> GetFullShortAccountList(bool logRequestResponse)
{
    var accounts = new List<ShortAccount>();        
    var accountQueryService = new QueryService<Account>
                                 (GetIppServiceContext(logRequestResponse));
    var selected = accountQueryService.Select(a => new { a.Id, a.Name });
    foreach (var account in selected)
    {
        accounts.Add(new ShortAccount { Id = account.Id, Name = account.Name });
    }
    return accounts;
}

Now the behavior of this method is as expected, but if I look at the request/response logs (or the actual request and response using Fiddler) the request doesn't change -- it is still "Select * from Account", and the response still includes all the other properties in the Account entity. 现在,此方法的行为符合预期,但是如果我查看请求/响应日志(或使用Fiddler的实际请求和响应),则请求不会更改-它仍然是“从帐户中选择*”,并且响应仍包括帐户实体中的所有其他属性。

In other words, the payload is not reduced one iota. 换句话说,有效载荷不会减少一个iota。

Am I doing something wrong here? 我在这里做错什么了吗? Or do I just understand this incorrectly? 还是我只是理解不正确?

How can I use the SDK to generate a query that would look more like "Select Id, Name from Account", and only return that result set? 如何使用SDK生成看起来更像“从帐户中选择ID,名称”的查询,并且只返回该结果集?

Related question -- if this mode of query filtering does not reduce the payload, what is its purpose? 相关问题-如果这种查询过滤模式不会减少有效负载,其目的是什么? You might as well get the whole shebang and just take the fields you need? 您不但可以获取全部所需费用,还可以选择所需的字段?

Thanks in advance. 提前致谢。

That's right @Barrick. 没错,@ Barrick。 The implementation of our query providers is not exactly the same as the standard LINQ. 我们的查询提供程序的实现与标准LINQ并不完全相同。 So, Stephan, that's the issue. 所以,斯蒂芬,这就是问题所在。

If you just want to get specific fields I would suggest you to use IDSQuery like: 如果您只想获取特定字段,建议您使用IDSQuery:

QueryService<Account> AccQueryService22 = new QueryService<Account>(context);
var t13 = AccQueryService22.ExecuteIdsQuery("Select Id, Name From Account Where Active in (true, false)");

I will forward the feedback to our team. 我会将反馈转发给我们的团队。

Thanks! 谢谢!

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

相关问题 QuickBooks Online(QBO)通过C#中的v2 IPP .NET SDK写入发票上的自定义字段 - QuickBooks Online (QBO) write to Custom Fields on Invoice via v2 IPP .NET SDK in C# 使用.NET IPP QBOV3 SDK从c#在线通过QuickBooks API添加采购订单 - Adding a Purchase Order via QuickBooks API from c# online using .NET IPP QBOV3 SDK 使用.NET c#IPP数据服务SDK创建新的QuickBooks Bill时所需的属性 - Required Properties when using .NET c# IPP Data Service SDK to create new QuickBooks Bill C# 中的 IPP 打印 - 有可能吗? - IPP Printing in C# - Is it possible? 为什么使用QuickBooks IPP.NET SDK检索类代码失败并显示ValidationError? - Why does retrieving Class codes with QuickBooks IPP.NET SDK fail with a ValidationError? PHP是否具有任何扩展名/库,允许您在PHP代码中使用.NET(C#)资源(源)? - Does PHP have any extension/lib that allows you to use .NET (C#) resources (sources) in PHP code? 如何使用C#实现IPP网关? - How to implement IPP gateway using C#? Lambda查询上的c#多个独立过滤器 - c# Multiple Independent Filters on Lambda Query 带有过滤器的 C# 中的 MongoDB Linq 查询 - MongoDB Linq query in C# with filters IPP .NET 3.0 SDK迁移问题:“无法加载类型&#39;Intuit.Ipp.Core.Rest.SyncRestHandler&#39;” - IPP .NET 3.0 SDK Migration Issue: “Could not load type 'Intuit.Ipp.Core.Rest.SyncRestHandler'”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM