Вы находитесь на странице: 1из 6

How to: How to modify a service and trigger in the same assembly?

Further reading
Microsoft Dynamics AX 2012 for Developers [AX 2012] SDK Download

Tutorial
Dynamics Retail AX Retail POS load services and triggers from assemblies at runtime. These assemblies should be placed under {AppPath}\Services and {AppPath}\Triggers folder for services and triggers respectively. A service in POS is an assembly that implements one or more of any of the following interface: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. IApplicationService IBarcode IBlankOperations ICard ICashChanger ICCTV ICorporateCard ICreditMemo ICurrency ICustomer ICustomField IDialog IDimension IDiscount IEFT IEOD IGiftCard IInfoCodes IItem ILoyalty 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. IPeripherals IPharmacy IPrice IPrinting IPurchaseOrder IRFID IRounding ISalesInvoice ISalesOrder IStockCount IStoreInventoryServices ITax ITaxFree ITenderRestriction ICharges IInteraction ILogOn ITimeRegistration IEnumerable<IBlankOperations>

In a similar way POS triggers assemblies ar the onesthat implements any of the following POS triggers interface 1. 2. 3. 4. 5. IApplicationTrigger ICashManagementTrigger ICustomerTrigger IDiscountTrigger IInfocodeTrigger 6. 7. 8. 9. 10. IItemTrigger IPaymentTrigger ISuspendTrigger ITransactionTrigger IOperationTrigger

NOTE: Definition of above interfaces can be found in Microsoft.Dynamics.Retail.Pos.Contracts.dll assembly under POS application directory or in Contracts project under LSPOSNET solution if access to source code is available. Each of these interface implement IService interface. POS loads these services/triggers at the time of initialization using Managed Extensibility Framework (MEF). MEF loads assemblies from configured path and searches them for the types are implemented in it and hooks its to its corresponding service/triggers property in POSApplication object. NOTE: To have a trigger and a service in an assembly is as simple as adding implementation of more than one of the above service/trigger interface in it.

Figure 1 : Example for a service and a trigger implemented in seperate assemblies.

Above example demonstrate rounding serivice and customer trigger implementation. Following steps will demonstrate who these two can be combined in a same assembly for use.

Create a new class Library project

Figure 2 : New library project.

In Solution Explorer Select Project Right Click AddExisting Items

Figure 3: Add Existing or Create new code files that implement the Service Interface.

Select the LogOn.cs file by browsing its physical path. Repeat the same steps for Loyalty.cs file. Add necessary references to the project and build it successfully.

Figure 4: Adding references to project dependencies.

Open the target location where the CombinedService.dll assembly is created

Figure 5: Output assembly with trigger and services combined.

Copy this DLL to move to services folder under POS Application directory.

Figure 6: Drop the assembly to Service folder of POS installation path.

Start POS and test the assembly.

Вам также может понравиться