I would like to query for all invoices in a customer. The SDK has some LinqExtender extensions so one would think you could do (for example customer id '1' which maps to an existing customer):
CreateQueryService<IppData.Invoice>().Where(x => x.CustomerRef.Value = "1")
But, this produces the following SQL:
Select * FROM Invoice WHERE CustomerRef.Value = '1'
which is a no-go:
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-08-24T13:41:04.367-07:00">
<Fault type="ValidationFault">
<Error code="4001">
<Message>Invalid query</Message>
<Detail>QueryValidationError: Property CustomerRef.Value not found for Entity Invoice</Detail>
</Error>
</Fault>
</IntuitResponse>
The correct SQL would read:
Select * FROM Invoice WHERE CustomerRef = '1'
Of course using SQL directly and creating dynamic queries (eww) works, but I was hoping there was a better way. I like the readability and (hopefully) type-safe-goodness of the Linq extensions, and you'd think this would be such a common thing to do. Unfortunately the documentation is a huge maze and severely lacks any kind of useful examples, so: does anyone know how to do this, or are we stuck with string SQL?
Yes, the SDK has Linq extender extensions but this is not working as expected. I have raised a bug for this. Unfortunately you will have to use the regular query operations for this.