Querying NAV OData web services with LINQ
Language Integrated Query (LINQ) is an extremely convenient interface for writing SQL queries in .NET languages. SQL-like queries are integrated in the .NET syntax, so that the developer can write application code and database queries in a unified way instead of injecting database interaction statements in text constants.
The System.Linq library allows access to different data sources, including OData service interfaces.
How to do it...
Now we will walk through receiving data from a NAV page with a LINQ query.
Publish page 42 Sales Order as a web service. Refer to the Exposing and consuming OData web services recipe for a step-by-step description of OData service publishing. Assign the name
SalesOrder
to the new service.In Visual Studio, start a Console Application project:Â
NAVSalesOrdersWebService
.Open the Add Service Reference dialog. Run service discovery onÂ
http://
localhost:7048/DynamicsNAV90
/OData/
Select the service NAV in the list of discovered...