Update the Sitecore.Commerce.ServiceProxy project

Version: 10.3

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 CommerceShops 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.

You can update the Sitecore.Commerce.ServiceProxy project to allow your storefront site to take advantage of strongly typed custom code implemented through the creation of your own plugin.

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

To update the Sitecore.Commerce.ServiceProxy project:

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 ( 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.

  3. Open a PowerShell window, and run the following script to update the Sitecore.Commerce.ServiceProxy project:

    RequestResponse
    ../Commerce.SDK/src/Sitecore.Commerce.ServiceProxy/Connected
    Services/update-proxy.ps1

    The Sitecore.Commerce.ServiceProxy project is now up-to-date.

Do you have some feedback for us?

If you have suggestions for improving this article,