Thursday, June 21, 2018

SysOperation framework

Finally found a good article on SysOperation framework with detail explaination on http://devexpp.blogspot.com/2013/11/introduction-to-sysoperation-framework.html

SysOperation framework (formerly known as the Business Operation framework, or BOF) when you extend Microsoft Dynamics AX by adding new functionality that may require batch processing.

The SysOperation framework replaces the RunBase Framework and provides infrastructure for creating user interaction dialog boxes and integration with the batch server for batch processing.

The purpose of the SysOperation framework is to provide the same capabilities as the RunBase framework but with base implementations for common overrides.

 The SysOperation framework handles

  • basic user interface creation 
  • parameter serialization 
  • routing to the CLR execution environment. 
 SysOperation framework works in a  Model-View-Controller (MVC) pattern. 

SysOperation framework Classes:
Contract class     ---------- SysOperationDataContractBase 
UI Builder class  ---------- SysOperationAutomaticUIBuilder
Controller            ---------- SysOperationServiceController
Service                 ---------- SysOperationServiceBase


• Service: Service class extends from the SysOperationServiceBase class and contains the business logic for the batch operation. Developers often tend to add the business logic in controller classes, which violates the Single responsibility principle.
• Data Contract: Data contract class is the model class defining attributes needed for batch operations. These attributes are provided by the user, in a dialog. DataContractAttribute attribute is needed for the class and the properties methods requires DataMemberAttribute attribute.
• Controller: Controller class extends from the SysOperationServiceController class. It holds information about the batch operation like execution mode, show dialog or progress bar etc. and directs the batch operation.
• UI Builder: UI Builder class extends from SysOperationAutomaticUIBuilder class and is used for adding custom behavior to dialog / dialog fields dynamically constructed by the SysOperation framework.

Data Contract:
The data contract is the model class in which we define which attributes we need in our operation, commonly set as parameters by the user in a dialog. 
It's nothing more than a model class with a few attributes in it. 

We can define a SysOperation Data Contract class simply by adding the DataContractAttribute attribute to its declaraion. 

Additionally, if we want a set of methods to be available to us, we can also extend the SysOperationDataContractBase base class. With this class, we can define how our basic dialog will look like to the user. 

We can define labels, groups, sizes and types of the parameters.


UI Builder:
The UI builder class is actually an optional class for the SysOperation framework, which kind of acts as the view part of the pattern. 

You should only use it if you want to add some extra behavior to the dialog that AX constructs dynamically for you.  

To create a UI Builder, you should extend the SysOperationAutomaticUIBuilder class. It will provide you a set of methods to work with the dialog's design, but we usually add extra behavior or customize a lookup inside the postBuild method.


Controller:
The controller class has greater responsibility than the others. As the name suggests, it is the class that orchestrates the whole operation. 

The controller class also holds information about the operation, such as if it should show a progress form, if it should show the dialog, and its execution mode - asynchronous or not. 

To create a controller class you should extend the SysOperationServiceController, which will give you all of the methods you need.

Service:
You can create a service class! The only thing you have to do is extend the SysOperationServiceBase class and you're good to go. 

This class is the one that should contain all the business logic

When constructing your controller, you will indicate which class holds the operation that the controller will trigger.

1 comment:

  1. https://www.youtube.com/playlist?list=PLWSxgDbjVWTjxvgnaAZ0iK8o5dYHAYhrq

    Collection of Microsoft ERP Clips || ERP Licensing, Technical, Functional ,Manager Learning Videos Listing

    ReplyDelete

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// &l...