![]() |
VOOZH | about |
This article illustrates using LINQ to access tables within the SAP Netweaver Gateway via the CData ADO.NET Data Provider for SAP Netweaver Gateway. To achieve this, we will use LINQ to Entity Framework, which facilitates the generation of connections and can be seamlessly employed with any CData ADO.NET Data Providers to access data through LINQ.
See the help documentation for a guide to setting up an EF 6 project to use the provider.
Enter your data source connection information.
SAP Gateway allows both basic and OAuth 2.0 authentication. You can use basic authentication to connect to your own account, or you can use OAuth to enable other users to retrieve data from your service with their accounts. In addition to authenticating, set the following connection properties to access SAP Gateway tables.
In basic authentication, you use your login credentials to connect. Set the following properties:
You can connect to SAP Gateway using the embedded OAuth connectivity (without setting any additional authentication connection properties). When you connect, the OAuth endpoint opens in your browser. Log in and grant permissions to complete the OAuth process. See the OAuth section in the online Help documentation for more information on other OAuth authentication flows.
Below is a typical connection string:
User=user;Password=password;URL=https://sapes5.sapdevcenter.com/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/;InitiateOAuth=GETANDREFRESH;
Using the entity you created, you can now perform select , update, delete, and insert commands. For example:
SAPGatewayEntities context = new SAPGatewayEntities();
var salesorderlineitemsQuery = from salesorderlineitems in context.SalesOrderLineItems
select salesorderlineitems;
foreach (var result in salesorderlineitemsQuery) {
Console.WriteLine("{0} {1} ", result.Id, result.ProductID);
}
See "LINQ and Entity Framework" chapter in the help documentation for example queries of the supported LINQ.
Download a free trial of the SAP Netweaver Gateway Data Provider to get started:
Download NowLearn more:
👁 SAP Netweaver Gateway IconRapidly create and deploy powerful .NET applications that integrate with SAP Netweaver Gateway.