Saturday, October 23, 2021

Difference between SysOperation Framework and Runbasebatch Framework

Difference between batchprocessing and runbasebatch Framework

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


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[The single-responsibility principle is a computer-programming principle that states that every module, class or function in a computer program should have responsibility over a single part of that program's functionality, and it should encapsulate that part.]

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.


SysOperation framework Classes:

Contract class - SysOperationDataContractBase 

Service - SysOperationServiceBase

UI Builder class - SysOperationAutomaticUIBuilder

Controller - SysOperationServiceController





Here are the main differences between the two:

RunBaseBatch:

Legacy framework: RunBaseBatch is an older framework available in earlier versions of Dynamics AX (before AX 2012). It's still supported in Dynamics 365 F&O, but Microsoft encourages the use of the SysOperation framework for new development.

Object-oriented: RunBaseBatch uses an object-oriented approach, which allows developers to create classes that inherit from the RunBaseBatch class.

Serialization: RunBaseBatch requires manual serialization of class members using the pack and unpack methods. This can lead to errors and inconsistencies if not implemented correctly.

Limited support for user interface (UI) controls: The RunBaseBatch framework has limited support for UI controls, such as dialog boxes, which may require additional customization.

SysOperation Framework:

Modern framework: SysOperation was introduced in Dynamics AX 2012 and is the recommended framework for background processing and batch tasks in Dynamics 365 F&O.

Attribute-based: SysOperation uses attributes to define the class and its methods, making it easier to understand and manage.

Automatic serialization: SysOperation automatically handles serialization, reducing the chances of errors and inconsistencies.

Better UI support: The SysOperation framework provides better support for UI controls, such as dialog boxes, making it easier to create user-friendly interfaces for batch processing tasks.

Integration with Application Object Tree (AOT): SysOperation integrates with AOT, which provides an organized way to access and manage application objects.

In conclusion, while both frameworks can be used for batch processing and background tasks in Dynamics 365 F&O, the SysOperation framework is the recommended choice due to its modern architecture, automatic serialization, better UI support, and integration with AOT. RunBaseBatch is still supported, but it is considered a legacy framework and should only be used for maintaining existing implementations or when specific requirements demand its use.