Generate the Sitecore.Commerce.ServiceProxy project

Abstract

How to generate the Sitecore.Commerce.ServiceProxy project, a strongly typed OData client, for your Commerce solution customization project.

The Sitecore.Commerce.ServiceProxy project is a strongly typed OData client that you can use when you write code to customize your storefront.

The Sitecore.Commerce.ServiceProxy project is included in the Sitecore.Commerce.Engine.SDK package. The project contains two OData connected services, the CommerceOps service and the Commerce Ops service.

The Sitecore.Commerce.ServiceProxy project in Visual Studio

Each connected service connects to a metadata endpoint on the Commerce Engine (defined in the ConnectedService.json file), and uses the data returned to generate copies of entities and controllers, in a format that your storefront projects can reference. When you have generated the proxy, you can reference the Sitecore.Commerce.ServiceProxy project in your storefront projects and refer to Commerce Entities in a strongly typed way.

The following procedure is based on the assumption that you have deployed the engine, and ran it from Visual Studio on default port 5000.

To generate the Sitecore.Commerce.ServiceProxy:

Note

You must have the Odata Connected Service client installed as a prerequisite to this procedure. You can find and install it directly from Visual Studio (under Tools>Exensions and Updates>Online).

  1. In Visual Studio, open the Sitecore.Commerce.ServiceProxy project, and expand the ConnectedServices folder.

  2. For each of the connected services (that is, CommerceOps and CommerceShops), right-click the name of the service, and then click Update OData Connected Service.

    Note

    This action triggers the Metadata service endpoint of the Commerce Engine, and rebuilds the generated code file.