develop and customize dynamics ax safely and effectively
TRANSCRIPT
Develop and customize Dynamics AX safely and effectivelyPeter VilladsenPrincipal Program Manager
BRK4026
Developer Experience
• Ax Applications are typically mission critical.
• Development is complex.• Understanding the problem space is
prerequisite for developing.• Requires modern best practices in software
development: SCC, encapsulation, patterns, test etc.
Characteristics of Dynamics AX development
Metadata + Code == Application
• Application development for AX7:• Takes place in the X++ language, with some C# when needed.• Takes place entirely within Visual Studio.• Is based on a solid metadata foundation.• Is supported by a strong lifecycle management support infrastructure.
The Developer Experience
• X++ is a type-safe Object Oriented Programming language, in the style of C# and Java.
• It features several innovations that allow it to better support the development of ERP systems.
• X++ is backed by a full stack of compiler, debugger, profiling tools, cross reference tools etc.
• X++ generates MSIL code.
The X++ language
• X++ provides abstractions for:• Classes, tables, views, queries, extended data types, enumerations, …
• X++ provides all the common OO features:• Inheritance, polymorphism, static/instance methods, encapsulation,
late binding, …• X++ has first-class data access support:• Select, insert_recordset, update, delete_from etc.
• Has a few bleeding edge features:• Extension classes, Class augmentation, Type Providers.
The X++ language
• Visual Studio is the environment for developing AX7 applications.
• Strong integration is provided:• Supports the concepts of models and packages.• Full support for editing both code and metadata through designers.• X++ editor featuring intellisense, colorization etc.• Backed by cross reference database for navigation.• Full support for the Visual Studio debugger.• Seamless error message handling.
Visual Studio
• It is quite possible to add keyboard code snippets for boilerplate code etc.
• It is also possible to add your own AX extensions.• Global Add-ins• Add-ins per artifact type
Visual Studio Extensibility
AX7 Visual Studio Extensibility optionsPeter Villadsen
• A new, high-performance compiler has been provided.
• It powers the compilation, but also other scenarios• Best practices• Analysis of breaking changes.• Ad-hoc tools.
• Metadata and some intellsense is powered by a background process, the xppcAgent.
Visual Studio: X++ compiler stack
Demo
The Dynamics ‘AX 7’ Visual Studio Development Tools
The development environmentAX 7 Development Environment
Visual StudioLocal runtime
Metadata (model store)
‘AX 7’ Extensions:
• Project system• X++ code editor• Designers• Application Explorer• Design time meta-model• Best practice integration• …others AOS hosted by
IISDeployment Package(metadata and binaries)
Business Databas
e
Deploy to cloud environment
Metadata APIRuntime
Debug/Run (F5)
Build
Model binaries (File system)
Batch manager service
• A Dynamics ‘AX 7’ model is a group of elements (metadata and source files) that typically constitute a distributable software solution (including customizations of an existing solution). A model is a design-time concept. • For example: A warehouse management model, a project accounting model, …etc.)
Concepts: Model
• A Dynamics ‘AX 7’ package is a deployment and compilation unit of one or more models. It includes model metadata, binaries, cubes and other associated resources. One or more ‘AX 7’ packages can be package into a deployment package, which is the vehicle used for deployment on UAT and production environments.
Concepts: Package
Packages, Models and VS ProjectsProjects, models and packages
'AX 7' Project
1 'AX 7' Model 1(Example: Application
Suite)'AX 7' Project
2'AX 7' Project
3
'AX 7' Project
6 'AX 7' Model 3(Example: Unit tests)'AX 7'
Project 7
Package 1 (Assembly and
associated runtime files)
'AX 7' Project
4'AX 7' Project
5
'AX 7' Model 2(Example: Expense)
Package 2 (Assembly and
associated runtime files)
Depends on
Application ExplorerIn model view, Application Explorer is organized by models.Each model is a child node of the AOT root node.The package that a model belongs to is shown in parenthesis next to the model name.
Microsoft Confidential
Packages on disk• Packages are folders located
in the model store folder of the Dynamics ‘AX 7’ application.
• The default model store folder is typically “c:\packages\”.
• Here you can see the folders of the ApplicationSuite package and the ApplicationFoundation package among others.
Microsoft Confidential
Models on disk• Model folders are contained in their
package folder.• A model folder contains type-
specific folders. • For example all tables in a model
belong to the folder AxTable.• The image on the right shows the
FleetManagement model folder.• The FleetManagement model folder
belongs to the FleetManagement package folder.
Microsoft Confidential
Model Descriptors• A package folder
contains a descriptor folder that lists all models that belong to the package.
• A model descriptor file contains metadata about a model’s properties.
• The image on the right shows 2 descriptor files of 2 models that belong to the FleetManagement package.
Microsoft Confidential
Full build dialogAccess the full build dialog from Dynamics ‘AX 7’ > Build models…All packages are listed, one package = one compiled assembly.Models within a package are shown in brackets.
Microsoft Confidential
Supported extensions as of today
Metadata• Create new elements (All AX types)• Extend tables: • Add new field, add field to field group, add
new field group, add new index, add new relation
• Extend forms:• Add a control, Add a form part, add a data
source, change the label, caption, help text, visible, and enabled properties of an existing control.
• Extend menus: • Add submenu, add menu item, add tile, hide
menu item.• Extend enums, security duties/roles.• Extend EDTs • Change label, fornhelp, and string size
properties.• Extend data entities, queries, views• Add field mappings to maps.
Source Code• Create new X++ classes• Application events
• Create event handlers (For app delegates)
• Framework events• Create data event handlers
(tables)• Create form event handlers• Create form data source and
data field event handlers• Create event handler for form
control events• Create plugins• Create static extension methods to
classes and tables.• Create static and instance methods
and add state through class augmentation.
Package dependencies graphMicrosoft Confidential
Right-click on the AOT and select View package dependencies to generate a graph depicting dependencies between packages of your application.
Demo
The X++ Metadata
Customization
Customization Concepts in Dynamics ‘AX 7’
Example-1: Overlayering customizations in base package
Assembly (Microsoft. Dynamics.Application.dll)
ISV-1 Overlay of
MS
ISV-2 Overlayof MS
VAR Overlay of ISV-1 and ISV-2
MS Application Suite Model
Overlayering model (Granular metadata and code customizations)Extension model (Metadata and code extensions) Example-2: Extension based
customizations in separate packages
Assembly ISV2.Extensio
ns.dll
Assembly (Microsoft. Dynamics.Application.dll)
ISV-1 Extensions on MS
Assembly (VAR.Extensions.dll)VAR Extensions on ISV-1 and
ISV-2
MS Application Suite Model
Assembly ISV2.Extensio
ns.dll
ISV-2 Extensions on MS
Example-3: Hybrid scenario with both extension and over-layering
Assembly ISV1.Extensi
ons.dll
Assembly (Microsoft. Dynamics.Application.dll)
ISV-1 Extensions on MS
Assembly (VAR.Extensions.dll)VAR Extensions on ISV-1 and
ISV-2
MS Application Suite Model
Assembly ISV2.Extensions
.dll)
ISV-2 Extensions
on MS
VAR Overlay of ISV-2
ISV-1 Overlay of
MS
• Pros:• Any piece of metadata or code can be modified in a granular (but
intrusive) way: You are essentially making it your own so you can do what you want with it.
• Cons• You are now responsible for the code that you are overriding. When
changes are made to that (original) code, you may have a hard time reconciling it with your changes: You sometimes have to start from scratch. Huge costs are incurred.
• Over-layering does not work in the cloud. The changes made by a partner are compiled into the assembly that is deployed. There is no separation of the IP.
• ISVs essentially have no guarantees that the application still runs correctly.
• You cannot use overlayering in the platform and foundation models.
Overlayering
Extensions: Concept and value proposition
Application Suite Package
Application Suite Extension Package
AOS RuntimeDynamics.AX.ApplicationSuite.dll
Dynamics.AX.AppSuiteExtension.dll
AxFormAxTableAxTableExtension
AxFormExtension
AxForm
AxTableEvents & Plugins
References
Code Extensions
AxClass
CompileCompile
Compile Isolation & performance
Deployment, servicing and ALM
Minimal code upgrade cost
• Pros• Lightweight compilation: You are only compiling changes.• With ALM, you’ll only manage your extension artifacts. This
simplifies and improves the performance of deployments and test automation.• Servicing is reduced to copying DLLs with no impact to
partner customizations.• There is a loose coupling between the original code and
partner code. There is a very good chance that you will not have to react to changes made: No costly reimplementation. • It is very easy to get rid of the changes made by extension:
Just remove the assembly and restart.
Extensions
• Cons• You cannot easily achieve everything; You cannot change the
implementation of a particular method, for instance. • Not all metadata is extensible yet (but we are close).• Private / protected / public ?• Does not expose virtual behavior.
Extensions
Demo
Customizations
• Always extend rather than overlayer.• Prepare your code to be extended.• Heed the best practice warnings!• Test early, test often, test automatically• Do code reviews. Always. Really.
Advice
Free IT Pro resourcesTo advance your career in cloud technology
Cloud role mapping Expert advice on skills needed Self-paced curriculum by cloud role $300 Azure credits and extended trials Pluralsight 3 month subscription (10 courses) Phone support incident Weekly short videos and insights from Microsoft’s leaders and engineers Connect with community of peers and Microsoft experts
Microsoft IT Pro Career Centerwww.microsoft.com/itprocareercenter
Microsoft IT Pro Cloud Essentials www.microsoft.com/itprocloudessentials
Microsoft Mechanics www.microsoft.com/mechanics
Microsoft Tech Community https://techcommunity.microsoft.com
Plan your career path
Get started with Azure
Connect with peers and experts
Demos and how-to videos
From your PC or Tablet visit MyIgnite at http://myignite.microsoft.com
From your phone download and use the Ignite Mobile App by scanning the QR code above or visiting https://aka.ms/ignite.mobileapp
Please evaluate this sessionYour feedback is important to us!
© 2016 Microsoft Corporation. All rights reserved.