Monday, May 21, 2018

Sitecore Experience Commerce - Command won't resolve in commerce engine

I have a custom API in the commerce engine which was able to be called via Postman. However when debugging the API, it was unable to get a copy of my command. The line of code which was failing was:
var myCommand = Command<MyCustomCommand>();
This was returning null. What was missing that the command was not properly being registered, this is done in the  ConfigureSitecore class of the plugin which contains the command and is achieved with the following line of code:
services.RegisterAllCommands(assembly);
After this the command was able to be accessed and run correctly.

No comments:

Post a Comment