1 / 16

MVC in AX2012

MVC in AX2012. 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

mray
Download Presentation

MVC in AX2012

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MVC in AX2012 Rama Sridhar Ramasridhar_rr@hotmail.com http://ramasridhar.wordpress.com

  2. Agenda • What is MVC? • Overview on BOF • BOF in Services • BOF in Reports • Q&A

  3. What is MVC? Is MVC an architecture or design pattern?

  4. 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

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

  6. Components • DataContract • Controller • Service class • UIBuilder

  7. Example

  8. Sequence

  9. BOF in Services Methods Diaglog() GetFromDialog() PutToDialog() Prompt() Run() Main() Member variables pack/unpack methods

  10. BOF Service Demo

  11. 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

  12. What are the ways to customize UI? • Attribute based customizations. Attributes are SysOperationGroupAttribute, SysOperationGroupMemberAttribute, SysOperationDisplayOrderAttribute, SysOperationLabelAttribute, SysOperationHelpTextAttribute etc. • Code based customizations. Using UIBuilder class. For example check CustRecurrenceInvoiceUIBuilder Class.

  13. DataContract • 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.

  14. 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 ObjectType to Class • Set the Object to SysOperationServiceController • Set the Parameters to <ServiceClassName>.<MethodName> • 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

  15. BOF in Reports • 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

  16. View:SrsReportDataContractUIBuilderModel:SrsReportDataContract/SrsReportDataProviderBaseView:SrsReportDataContractUIBuilderModel:SrsReportDataContract/SrsReportDataProviderBase Controller:SrsReportRunController

More Related