Call CRT service in offline mode
This topic applies to Dynamics 365 for Retail and Dynamics 365 for Finance and Operations, Enterprise edition.
This topic describes how provide offline support for point of sale (POS).
When a point of sale (POS) device goes offline (in other words, when it isn't connected to Retail Server), the POS automatically switches to the local commerce runtime (CRT). The POS client communicates with the local CRT by using the Retail proxy. To enable the proxy to understand your custom service, you must extend the Retail proxy project to support your request type.
- In Microsoft Visual Studio, from the Retail SDK\Proxies folder, open Proxies.RetailProxy.csproj.
- Update RetailSDK\Proxies\RetailProxy\Adapters\UsingStatements.Extensions with the new namespace that you defined for the new entity/complex types that were introduced in CRT extension projects. These projects or dynamics-link libraries (DLLs) must first be referenced by Proxies.RetailProxy.csproj.
- Compile the Proxies.RetailProxy project. During compilation, Adapters\Interfaces.g.cs is updated with your new entity and interface information. Don't modify this automatically generated class.
- Add your new manager class to the Adapters folder, and call your CRT service from that manager. The standard entity manager classes, such as SalesOrderManager and PurchaseOrderManager, are available in the Adapters folder. Note: All the libraries that are used in the project must be portable and signed. (Any custom CRT service that is referenced must be a portable library.)
- Update the public key in the CRT configuration file, because a new public key is generated after compilation.
- Build and replace the new proxy DLL in the Microsoft Dynamics AX\70\Retail Modern POS\ClientBroker folder. Additionally, drop the custom CRT extension library into the Microsoft Dynamics AX\70\Retail Modern POS\ClientBroker folder. (All libraries that are referenced should be dropped into this folder.)
In the DllHost.exe.config file, update RetailProxyAssemblyName and AdaptorCallerFullTypeName with the new proxy DLL and adapter name.
<add key="RetailProxyAssemblyName" value="Contoso.Commerce.RetailProxy" /> <add key="AdaptorCallerFullTypeName" value="Contoso.Commerce.RetailProxy.Adapters.AdaptorCaller" />
In the CommerceRuntime.MPOSOffline.config file, in the <composition> element, update the new CRT DLL information as for the commerceRuntime.config file.
<add source="assembly" value="Contoso.Commerce.Runtime.Services" />
Restart dllhost.exe. (You should restart the dllhost.exe for MPOS to read the new config file, this will be required even when you do any upgrade if it has config file changes.)