We all know the SysOperation framework - the successor to the RunBaseBatch. Whenever you need to add a new periodic job to the system you have to create the following items:

  • Service class, which contains the code to perform the processing;
  • (Optional) Data contract class, which contains the parameters for the job;
  • (Optional) UI builder class, which allows you to customize the look of the prompt dialog;
  • Controller class, which configures how to run the job;
  • Action menu item pointing to your controller to let users run the job and configure security.

What if I told you that in most cases you don’t really need the controller? Less code is always good!

SysOperationServiceController Link to heading

SysOperationServiceController is a generic service controller class provided by Microsoft. For simple jobs, you don’t need to extend it with your own controller class - it can parse all the required information from the calling menu item if configured correctly. Set the following properties on the action menu item:

Property Value
ObjectType Class
Object SysOperationServiceController
Parameters <your service class name>.<static method name>
EnumTypeParameter SysOperationExecutionMode
EnumParameter <desired execution mode>

Here, you simply specify the class and method names of a service class and, optionally, execution mode (synchronous, asynchronous, forced batch, etc.) and SysOperationServiceController will do the rest. Now you have a working periodic operation and one less boilerplate class in your codebase.