Você está na página 1de 5

How to: How to modify more than one service in an assembly?

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

Tutorial
Dynamics Retail AX Retail POS load services from assemblies at runtime. These assemblies should be placed under {AppPath}\Services folder. 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>

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 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 property in POSApplication object. NOTE : To have more than one service in an assembly is as simple as adding implementation of more than one of the above interface in it. As shown in an example below ILoyalty and Ilogon services are implemented in two different projects and will yield two different assemblies. Lets create a single assembly for these two by following the below steps

Figure 1: Example for services implemented in seperate assemblies.

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

Você também pode gostar