MVC in AX2012 - WordPress.com

Download Report

Transcript MVC in AX2012 - WordPress.com

Rama Sridhar [email protected]

http://ramasridhar.wordpress.com

     What is MVC?

Overview on BOF BOF in Services BOF in Reports Q&A

Is MVC an architecture or design pattern?

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

    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).

    DataContract Controller Service class UIBuilder

Prompt() Run() Main() Methods Diaglog() GetFromDialog() PutToDialog() Member variables pack/unpack methods

Demo

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

  Attribute based customizations.

Attributes are SysOperationGroupAttribute, SysOperationGroupMemberAttribute, SysOperationDisplayOrderAttribute, SysOperationLabelAttribute, SysOperationHelpTextAttribute etc.

Code based customizations.

Using UIBuilder class. For example check CustRecurrenceInvoiceUIBuilder Class.

  ◦ Validate DataContract at design time To perform validation on contract class, you need to implement SysOperationValidatable Interface and override the validate method. For example of this, check CustRecurrenceInvoiceDataContract class.

◦ ◦ Modify DataContract at run time To modify the contract at runtime, we need to create a controller class extend from SysOperationServiceController class.

Get the contract object by calling the method getDataContractObject from controller class instance and then call the corresponding parm methods of contract class, passing the desired values.

    A Business Operation Framework service can be called in four ways: As a menu item ◦ Create an Action Menu Item ◦ ◦ ◦ Set the ObjectType to Class Set the Object to SysOperationServiceController Set the Parameters to . 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 EnumTypeParameter=SysOperationExecutionMode; EnumParameter=Synchronous Asynchronously ◦ To run the service synchronously, edit the menu item, set EnumTypeParameter=SysOperationExecutionMode; EnumParameter=ASynchronous

  AX 2012 report programming model is build on SysOperation Framework In AX2012, we have 2 options to develop reports ◦ Modeled solution aka query based ◦ Code based solution aka Report data provider based

View: SrsReportDataContractUIBuilder Model: SrsReportDataContract /SrsReportDataProviderBase Controller: SrsReportRunController