Sysoperation VS RunBase

 

What is the Sysoperation framework how it is different from the runbase framework?


In Microsoft Dynamics AX 2012 & D365FO, the SysOperation system supplanted the RunBase system to bolster the group preparing usefulness. Going forward, the SysOperation system is prescribed for composing custom trade rationale that requires clump handling usefulness, over the censured RunBase framework. The RunBase system characterizes coding designs that actualize these necessities. The SysOperation system gives base executions for numerous of the designs characterized by the RunBase system. Another incredible thing is SysOperation system streamlined the pack / unload of factors that were extra work within the RunBase system, taking advantage of the Traits highlight presented with AX 2012 & D365FO.

SysOperation framework allows application logic to be written in a way that supports running operations interactively or via the Microsoft Dynamics AX & D365FO batch server. It implements the MVC (Model–View–Controller) design pattern, with the isolation of Parameters (Model), Dialog (View), and Service (Controller), for the code that’s executed.


The key objects of the framework are defined below:

Service:

The 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 require the 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.

Support Faryal's Cusine


Updating the cross-references

 


                Cross Reference Dynamics Finance & Operations


  • Navigate to MS Dynamics AX > Tool > Development Tools > Cross-reference > Periodic > Update
  • The Update cross-reference window appears.
  • Select update all and click the OK button. It will create a batch job and start running the batch job.
  • Usual time ranges from 3-4 hours depending upon the performance of the server.

Support Faryal's Cusine


Concept of extensions

 

Define Concept of Extensions



An extension is a way to add functionality to an object in D365FO without modifying the base code of that object.  

Your extensions are compiled into their own DLLs, which are separate from the D365 base system libraries. It also makes it easier for Microsoft to patch their sys layer code.

Microsoft has added to allow customizations without allowing the base code to be changed because they plan to not allow any overlaying of SYS layer code. 


Here are my old articles

Support Faryal's Cusine


Overloading vs Overriding

 

Overloading vs Overriding 



Polymorphism means “Many Forms”. In Polymorphism, poly means “Many” and morph means “Forms.” Polymorphism is one of the main pillars in Object-Oriented Programming. It allows you to create multiple methods with the same name but different signatures in the same class. The same name methods can also be in derived classes.
 
There are two types of Polymorphism,
  1. Method Overloading
  2. Method Overriding
In this article, I will explain method overloading and method overriding concepts in X++. I will try to demonstrate step-by-step differences between these.
 

Method Overloading

Method Overloading is a type of polymorphism. It has several names like “Compile Time Polymorphism” or “Static Polymorphism” and sometimes it is called “Early Binding”.
 
Method Overloading means creating multiple methods in a class with the same names but different signatures (Parameters). It permits a class, struct, or interface to declare multiple methods with the same name with unique signatures.
 
The compiler automatically calls the required method to check the number of parameters and their type which are passed into that method.

Sample Code


   public class Program  
    {  
        public int Add(int num1, int num2)  
        {  
            return (num1 + num2);  
        }  
        public int Add(int num1, int num2, int num3)  
        {  
            return (num1 + num2 + num3);  
        }  
        public float Add(float num1, float num2)  
        {  
            return (num1 + num2);  
        }  
        public string Add(string value1, string value2)  
        {  
            return (value1 + " " + value2);  
        }  
        static void Main(Args _args)  
        {  
            Program objProgram = new Program();  
           Info("Add with two int parameter :" + objProgram.Add(3, 2));  
           Info("Add with three int parameter :" + objProgram.Add(3, 2, 8));  
           Info("Add with two float parameter :" + objProgram.Add(3 f, 22 f));  
           Info("Add with two string parameter :" + objProgram.Add("hello", "world"));  
           
        }  
    }  


In the above example, you can see that there are four methods with the same name but the type of parameters or number of parameters is different. When you call Add(4,5), complier automatically calls the method which has two integer parameters and when you call Add(“hello”,” world”), complier calls the method which has two string parameters. So basically in method overloading complier checks which method should be called at the time of compilation.
 
Note: Changing the return type of method does not make the method overloaded. You cannot create method overloaded vary only by return type.



Method Overriding

 
Method Overriding is a type of polymorphism. It has several names like “Run-Time Polymorphism” or “Dynamic Polymorphism” and sometimes it is called “Late Binding”. 
 
Method Overriding means having two methods with the same name and same signatures [parameters], one should be in the base class and another method should be in a derived class [child class]. You can override the functionality of a base class method to create the same name method with the same signature in a derived class. You can achieve method overriding using inheritance. Virtual and Override keywords are used to achieve method overriding.

class BaseClass  
    {  
        public virtual void Add(int num1, int num2)  
        {  
           // your logic will be here 
        }  
    }  
    class ChildClass: BaseClass  
    {  
        public override void Add(int num1, int num2)  
        {  
          // your logic will be here
            ;  
        }  
    }  
    class Program  
    {  
        static void Main(Args _args)  
        {  
            BaseClass baseClassObj;  
            baseClassObj = new BaseClass();  
            Info("Base class method Add :" + baseClassObj.Add(-3, 8));  
            baseClassObj = new ChildClass();  
            Info("Child class method Add :" + baseClassObj.Add(-2, 2));  
          
        }  
    }  

In the above example, I have created two same name methods in the BaseClass as well as in the child class. When you call the BaseClass Add method with less than zero value as parameters then it adds successfully. But when you call the ChildClass Add method with less than zero value then it checks for a negative value. And the passing values are negative then it asks for a new value.
 
So, here it is clear that we can modify the base class methods in derived classes.
 
Points to be remembered,
  1. The method cannot be private.
  2. The only abstract or virtual method can be overridden.
  3. Which method should be called is decided at run time.

Support Faryal's Cusine


User Interface Builder Class

 


What Is User Interface Builder Class


The User Interface Builder Class is the layout parameter dialog box that opens when a report is running in the Microsoft Dynamics AX Or Finance & Operations. 

The User Interface also adds customization and additional fields for the dialog, You can also use this class to write the lookup and validation on the report dialog.


 UI Builder Class scenarios used are:

  1. Group the dialog fields
  2. Override the dialog field events
  3. For adding customized lookup dialog field
  4. To bind the dialog fields with contract parameters
  5. For changing layouts in dialog
  6. Adding more custom controls in the dialog

Support Faryal's Cusine


Interfaces & Abstract Class

 

Interfaces VS Abstract Class?




The class implementing is the interface that implements all interface methods and there will not be any abstract Class requirement. There are many access modifiers available like abstract, protected, virtual, internal, public, and many more that are useful in the abstract Classes. Abstract classes will be very fast when compared to interfaces.


Abstract class contains both the incomplete or complete methods and the interface is the signature for a particular method. The abstract class is the implemented method but the interface cannot be an implemented method.


The abstract class contains constructors, fields, or destructors for implementing the properties. The interface does not contain constructors, fields, or destructors but they have only the property’s signature with no implementation.

The abstract class does not support multiple inheritances and the interface supports multiple inheritances. The class can also inherit more interfaces but only a single abstract class.

































Support Faryal's Cusine


Pass By Reference and Pass By Value

 

Difference Between Pass By Reference And Pass By Value?


Pass By Reference: 

In Pass by reference address of the variable is passed to a function. Whatever changes made to the formal parameter will affect the actual parameters

  1. The same memory location is used for both variables. (Formal and Actual)
  2. It is useful when you are required to return more than 1 value.

Pass By Value:

  1. In this method value of the variable is passed. Changes made to formal will not affect the actual parameters.
  2. Different memory locations will be created for both variables.
  3. Here there will be a temporary variable created in the function stack that does not affect the original variable.

In the case of pass-by value, the change in the sub-function will not cause any change in the main function whereas in pass-by-reference the change in the sub-function will change the value in the main function.

Pass by value sends a COPY of the data stored in the variable you specify, pass by reference sends a direct link to the variable itself. So if you pass a variable by reference and then change the variable inside the block you passed it into, the original variable will be changed. If you simply pass by the value, the original variable will not be able to be changed by the block you passed it into but you will get a copy of whatever it contained at the time of the call.

Support Faryal's Cusine


Virtual Fields Vs Computed Fields

  Virtual Field: A virtual field in D365FO is a field that doesn't have a direct representation in the database. It's a field that y...