08 - Extensibility Best Practices
08 - Extensibility Best Practices
08 - Extensibility Best Practices
Module Overview
AX Retail POS (Point of Sales) is a .Net solution which is available as part of AX
Retail installation. The SDK will be available for the implementation team to
customize further as per the specific customers requirement. With the SDK we can
customize the POS services and Triggers only.
This document provides general guidelines on how to customize the Retail
solution and overall solution approach for the POS Retail part. As this is on .Net,
.Net specific coding guidelines will be applicable by default.
Objectives
8-1
Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
Solution Approach
There are two primary approaches for POS customization. These are:
1.
Greenfield Development
2.
Brownfield Development
Greenfield Development
The Greenfield approach for adding customizations on POS is to implement the
customization in default interfaces provided by the plugins. Then Replace the
OOB DLL provided by the Retail POS installation with the custom DLL.
For example, in order to customize the Sales Order service, load the services
solution form the Retail POS SDK(By default the SDK path will be
C:\Users\...\Documents\Retail SDK\POS Plug-ins\) folder and extend it by adding
the new classes and methods within the same SalesOrder project.
Brownfield Development
In brownfield development style, partial classes are used to keep customized
code separate from the OOB plugins code.
The advantages of using partial classes is that
During operations lifecycle of the system, you can more easily find if
the issue belongs to OOB Plugin code or it is customized code
In all Retail implementation of AX, each customer will have a specific requirement
for authorizing credit card payments. To do that, developer will have to modify
the EFT class provided in the EFT Project. To incorporate this change, follow the
below steps:
8-2
Rename the namespace to match the OOB class, which in the current
scenario, will be namespace EFT
If the class is not partial class, rename the class declaration to partial;
in the current scenario, it will be public partial class EFT: IEFT
Solution Configuration
When setting the solution in TFS, the delivery team must configure the complete
Services and Triggers solution in TFS. While configuring the Services or Triggers
solution, proper version of the AX Retail POS version must be chosen (AX 2012
R2)
From the Services or Triggers solution, the project specific solution must be
configured as a branch from the main application. By doing this, we are keeping
the original source code as is in the main solution and keep only the project
specific code in the branch
8-3
Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
The projects which we are not used for customization from the Retail SDK can be
removed from the TFS branch. In this way, the delivery team will be focused only
on the items they will be modifying and delivering to the customer. The solution
available in the branch should comply with the coding standards of .Net like
FxCop, StyleCop, VS Code analysis and Code metric standards. For detailed
information on these standards please refer the link in the reference section.
Unit Testing
It is usually conducted by the development team. This testing is to verify and
validate that the individual units of source code are fit for use.
Considerations:
Using Test Driven Development (TDD) developer can write unit test cases for
solution before actually writing that code. By writing a test and then writing the
code to make that test pass developers have a much better idea of what the goal
and purpose of the code is. Also, a TDD comprehensive suite of unit tests can be
run at any time to provide feedback that the software is still working. It improves
the quality of code and ensures total code coverage of custom code. The
developer can use Visual T#, NUnit, MS Test, xUnit or any other viable unit test
framework for TDD driven unit testing. For detailed information on the unit
testing please refer the link in the reference section
8-4
Reference
Partial Classes and Methods (C# Programming Guide) http://msdn.microsoft.com/en-us/library/wa80x488(v=VS.100).aspx
AX for Retail: A Better Sample for EFT plug-in (Credit Card processing)
http://blogs.msdn.com/b/axsupport/archive/2012/01/14/ax-for-retail-a-bettersample-for-eft-plug-in-credit-card-processing.aspx
C# coding guidelines
http://msdn.microsoft.com/en-US/library/vstudio/ms229042(v=vs.100).aspx
Guidelines for Test-Driven Development
http://msdn.microsoft.com/en-us/library/aa730844(VS.80).aspx
Test Driven Development
http://msdn.microsoft.com/en-us/library/aa730844(v=vs.80).aspx
Visual Studio 2010: Test Driven Development
http://msdn.microsoft.com/en-us/gg454254
FxCop
http://msdn.microsoft.com/en-US/library/bb429476(v=vs.80).aspx
Code analysis
http://msdn.microsoft.com/en-us/library/3z0aeatx.aspx
StyleCop
http://archive.msdn.microsoft.com/sourceanalysis
Code Metrics:
http://msdn.microsoft.com/en-us/library/bb385914.aspx
8-5
Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
Module Review
Best Practice:
1.
2.
3.
4.
8-6
1.
2.
2.
8-7
Microsoft Dynamics AX 2012 R2 For Retail in Brick and Mortar Stores Development and Customization
8-8