- Slides: 16
MVC in AX 2012 Rama Sridhar Ramasridhar_rr@hotmail. com http: //ramasridhar. wordpress. com
Agenda � What is MVC? � Overview on BOF � BOF in Services � BOF in Reports � Q&A
What is MVC? Is MVC an architecture or design pattern?
Pros and cons of MVC Pros: � Loosely coupled � Clear separation of UI, Data and Business logic � Test Driven � Code Reuse � Hide Data Access � Adaptable to change cons: � Duplicated code between common views � Not a true n-tier architecture (triangulation) � Not a true publisher – subscriber model
Business Operation Framework The Business Operation Framework service is one of the system services exposed by Microsoft Dynamics AX and that adheres to the Windows Communication Foundation (WCF) protocols and standards. Following are the features of BOF: � Allows menu-driven execution or batch execution of services. � Call services in synchronous or asynchronous mode. � Automatically creates a customizable UI based on the data contract. � Encapsulates code to operate on the appropriate tier (prompting on the client tier, and business logic on the server tier).
Components � Data. Contract � Controller � Service class � UIBuilder
BOF in Services Methods Diaglog() Get. From. Dialog() Put. To. Dialog() Prompt() Run() Main() Member variables pack/unpack methods
BOF Service Demo
How to create a BOF service? To create a Business Operation Framework service, the following steps must be performed: � Create a data contract class � Identify the parameters passed to the service � Register the class as a Business Operation Framework service � Optionally customize the automatically generated UI for the class
What are the ways to customize UI? � Attribute based customizations. Attributes are Sys. Operation. Group. Attribute, Sys. Operation. Group. Member. Attribute, Sys. Operation. Display. Order. Attribute, Sys. Operation. Label. Attribute, Sys. Operation. Help. Text. Attribute etc. � Code based customizations. Using UIBuilder class. For example check Cust. Recurrence. Invoice. UIBuilder Class.
Data. Contract � Validate Data. Contract at design time ◦ To perform validation on contract class, you need to implement Sys. Operation. Validatable Interface and override the validate method. For example of this, check Cust. Recurrence. Invoice. Data. Contract class. � Modify Data. Contract at run time ◦ To modify the contract at runtime, we need to create a controller class extend from Sys. Operation. Service. Controller class. ◦ Get the contract object by calling the method get. Data. Contract. Object from controller class instance and then call the corresponding parm methods of contract class, passing the desired values.
Calling a BOF service A Business Operation Framework service can be called in four ways: � As a menu item ◦ ◦ Create an Action Menu Item Set the Object. Type to Class Set the Object to Sys. Operation. Service. Controller Set the Parameters to <Service. Class. Name>. <Method. Name> � As a batch process ◦ Create a job and create the service method in that job � Synchronously ◦ To run the service synchronously, edit the menu item, set Enum. Type. Parameter=Sys. Operation. Execution. Mode; Enum. Parameter=Synchronous � Asynchronously ◦ To run the service synchronously, edit the menu item, set Enum. Type. Parameter=Sys. Operation. Execution. Mode; Enum. Parameter=ASynchronous
BOF in Reports � � AX 2012 report programming model is build on Sys. Operation Framework In AX 2012, we have 2 options to develop reports ◦ Modeled solution aka query based ◦ Code based solution aka Report data provider based
View: Srs. Report. Data. Contract. UIBuilder Model: Srs. Report. Data. Contract/Srs. Report. Data. Provider. Base Controller: Srs. Report. Run. Controller