Foreword Introduction PART I A TOUR OF THE DEVELOPMENT ENVIRONMENT Chapter 1 Architectural overview Introduction AX 2012 five-layer solution architecture AX 2012 application platform arc
Trang 2Inside Microsoft Dynamics AX
2012 R3
The Microsoft Dynamics AX Team
Trang 3PUBLISHED BY
Microsoft Press
A Division of Microsoft Corporation
One Microsoft Way
Redmond, Washington 98052-6399
Copyright © 2014 by Microsoft Corporation
All rights reserved No part of the contents of this book may be reproduced
or transmitted in any form or by any means without the written permission
of this book at http://aka.ms/tellpress
Microsoft and the trademarks listed at
http://www.microsoft.com/en-us/legal/intellectualproperty/Trademarks/EN-US.aspx are trademarks ofthe Microsoft group of companies All other marks are property of theirrespective owners
The example companies, organizations, products, domain names, emailaddresses, logos, people, places, and events depicted herein are fictitious
No association with any real company, organization, product, domainname, email address, logo, person, place, or event is intended or should beinferred
This book expresses the author’s views and opinions The informationcontained in this book is provided without any express, statutory, or
implied warranties Neither the authors, Microsoft Corporation, nor itsresellers, or distributors will be held liable for any damages caused oralleged to be caused either directly or indirectly by this book
Acquisitions Editor: Rosemary Caperton
Developmental Editor: Carol Dillingham
Editorial Production: Online Training Solutions, Inc (OTSI)
Copyeditors: Kathy Krause and Victoria Thulman (OTSI)
Trang 4Indexer: Susie Carr (OTSI)
Cover: Twist Creative • Seattle and Joel Panchot
Trang 5Foreword
Introduction
PART I A TOUR OF THE DEVELOPMENT ENVIRONMENT
Chapter 1 Architectural overview
Introduction
AX 2012 five-layer solution architecture
AX 2012 application platform architecture
Application development environmentsData tier
Middle tierPresentation tier
AX 2012 application meta-model architecture
Application data element typesMorphX user interface control element typesWorkflow element types
Code element typesServices element typesRole-based security element typesWeb client element types
Documentation and resource element typesLicense and configuration element types
Chapter 2 The MorphX development environment and tools
Introduction
Application Object Tree
Navigating through the AOTCreating elements in the AOTModifying elements in the AOTRefreshing elements in the AOT
Trang 6Element actions in the AOT
Element layers and models in the AOTProjects
Suppressing errors and warnings
Adding custom rules
Debugger
Enabling debugging
Debugger user interface
Debugger shortcut keys
Reverse Engineering tool
UML data model
UML object model
Entity relationship data model
Table Browser tool
Find tool
Compare tool
Starting the Compare tool
Using the Compare tool
Compare APIs
Trang 7Cross-Reference tool
Version control
Element life cycleCommon version control tasksWorking with labels
Synchronizing elementsViewing the synchronization logShowing the history of an elementComparing revisions
Viewing pending elementsCreating a build
Integrating AX 2012 with other version control systems
Chapter 3 AX 2012 and NET
Introduction
Integrating AX 2012 with other systems
Using third-party assembliesWriting managed code
Hot swapping assemblies on the serverUsing LINQ with AX 2012 R3
The var keyword
Extension methodsAnonymous typesLambda expressionsWalkthrough: Constructing a LINQ queryUsing queries to read data
AX 2012 R3–specific extension methodsUpdating, deleting, and inserting recordsLimitations
Advanced: limiting overhead
Chapter 4 The X++ programming language
Introduction
Jobs
Trang 8The type system
Value typesReference typesType hierarchiesSyntax
Variable declarationsExpressions
StatementsMacrosCommentsXML documentationClasses and interfaces
FieldsMethodsDelegatesPre-event and post-event handlersAttributes
Code access security
Compiling and running X++ as NET CILDesign and implementation patterns
Class-level patternsTable-level patterns
PART II DEVELOPING FOR AX 2012
Chapter 5 Designing the user experience
Introduction
Role-tailored design approach
User experience components
Navigation layer formsWork layer formsRole Center pages
Cues
Trang 9Designing Role CentersArea pages
Designing area pagesList pages
Scenario: taking a call from a customerUsing list pages as an alternative to reportsDesigning list pages
Details forms
Transaction details forms
Enterprise Portal web client user experienceNavigation layer forms
Work layer formsDesigning for Enterprise PortalDesigning for your users
Chapter 6 The AX 2012 client
Introduction
Working with forms
Form patternsForm metadataForm data sourcesForm queriesAdding controls
Control overridesControl data binding
Design node properties
Run-time modificationsAction controls
Layout controlsInput controls
ManagedHost control
Other controlsUsing parts
Trang 10Types of partsReferencing a part from a formAdding navigation items
MenuItem Menu
Menu definitionsCustomizing forms with code
Method overrides
Auto variables
Business logicCustom lookupsIntegrating with the Microsoft Office client
Make data sources available to Office Add-insBuild an Excel template
Build a Word templateAdd templates for users
Chapter 7 Enterprise Portal
Introduction
Enterprise Portal architecture
Enterprise Portal components
Web partsAOT elementsDatasets
Enterprise Portal framework controlsDeveloping for Enterprise Portal
Creating a model-driven list pageCreating a details page
AJAXSession disposal and cachingContext
DataMetadata
Trang 11Proxy classes
ViewState
LabelsFormattingValidationError handlingSecurity
Secure web elementsRecord context and encryptionSharePoint integration
Site navigationSite definitions, page templates, and web partsImporting and deploying a web part pageEnterprise Search
Themes
Chapter 8 Workflow in AX 2012
Introduction
AX 2012 workflow infrastructure
Windows Workflow Foundation
Key workflow concepts
Workflow document and workflow document classWorkflow categories
Workflow typesEvent handlersMenu itemsWorkflow elementsQueues
ProvidersWorkflowsWorkflow instancesWork items
Workflow architecture
Trang 12Workflow runtimeWorkflow runtime interactionLogical approval and task workflowsWorkflow life cycle
Implementing workflows
Creating workflow artifacts, dependent artifacts, and businesslogic
Managing stateCreating a workflow categoryCreating the workflow document classAdding a workflow display menu itemActivating the workflow
Chapter 9 Reporting in AX 2012
Introduction
Inside the AX 2012 reporting framework
Client-side reporting solutionsServer-side reporting solutionsReport execution sequencePlanning your reporting solution
Reporting and usersRoles in report developmentCreating production reports
Model elements for reportsSSRS extensions
AX 2012 extensionsCreating charts for Enterprise Portal
AX 2012 chart development toolsIntegration with AX 2012
Data seriesAdding interactive functions to a chartOverriding the default chart formatTroubleshooting the reporting framework
Trang 13The report server cannot be validated
A report cannot be generated
A chart cannot be debugged because of SharePoint sandboxissues
A report times out
Chapter 10 BI and analytics
Introduction
Components of the AX 2012 BI solution
Implementing the AX 2012 BI solution
Implementing the prerequisitesConfiguring an SSAS serverDeploying cubes
Deploying cubes in an environment with multiple partitionsProcessing cubes
Provisioning usersCustomizing the AX 2012 BI solution
Configuring analytic contentCustomizing cubes
Extending cubesIntegrating AX 2012 analytic components with external datasources
Maintaining customized and extended projects in the AOTCreating cubes
Identifying requirementsDefining metadata
Generating and deploying the cubeAdding KPIs and calculationsDisplaying analytic content in Role Centers
Providing insights tailored to a personaChoosing a presentation tool based on a personaSQL Server Power View
Power BI for Office 365
Trang 14Comparing Power View and Power BIAuthoring with Excel
Business Overview web part and KPI List web partDeveloping reports with Report Builder
Developing reports with the Visual Studio tools for AX 2012
Chapter 11 Security, licensing, and configuration
Introduction
Security framework overview
AuthenticationAuthorizationData securityDeveloping security artifacts
Setting permissions for a formSetting permissions for server methodsSetting permissions for controls
Creating privilegesAssigning privileges and duties to security rolesUsing valid time state tables
Validating security artifacts
Creating usersAssigning users to rolesSetting up segregation of duties rulesCreating extensible data security policies
Data security policy conceptsDeveloping an extensible data security policyDebugging extensible data security policiesSecurity coding
Table permissions frameworkCode access security frameworkBest practice rules
Security debuggingLicensing and configuration
Trang 15Configuration hierarchyConfiguration keysUsing configuration keysTypes of CALs
Customization and licensing
Chapter 12 AX 2012 services and integration
Introduction
Types of AX 2012 services
System servicesCustom servicesDocument servicesSecurity considerationsPublishing AX 2012 servicesConsuming AX 2012 services
Sample WCF client for CustCustomerService
Consuming system servicesUpdating business documentsInvoking custom services asynchronouslyThe AX 2012 send framework
Implementing a trigger for transmissionConsuming external web services from AX 2012
Field lists
Trang 16Field justificationPerformance configuration options
SQL Administration formServer Configuration formAOS configuration
Client configurationClient performanceNumber sequence cachingExtensive logging
Master scheduling and inventory closingCoding patterns for performance
Executing X++ code as common intermediate languageUsing parallel execution effectively
The SysOperation frameworkPatterns for checking to see whether a record existsRunning a query only as often as necessary
When to prefer two queries over a joinIndexing tips and tricks
When to use firstfast
Optimizing list pagesAggregating fields to reduce loop iterationsPerformance monitoring tools
Microsoft Dynamics AX Trace ParserMonitoring database activity
Using the SQL Server connection context to find the SPID oruser behind a client session
The client access logVisual Studio Profiler
Chapter 14 Extending AX 2012
Introduction
The SysOperation framework
SysOperation framework classes
Trang 17SysOperation framework attributesComparing the SysOperation and RunBase frameworks
RunBase example: SysOpSampleBasicRunbaseBatch SysOperation example: SysOpSampleBasicController
The RunBase framework
Inheritance in the RunBase frameworkProperty method pattern
Pack-unpack patternClient/server considerationsThe extension framework
Create an extensionAdd metadata
Extension exampleEventing
Delegates
Pre and post events
Event handlersEventing example
Chapter 15 Testing
Introduction
Unit testing features in AX 2012
Using predefined test attributesCreating test attributes and filtersMicrosoft Visual Studio 2010 test tools
Using all aspects of the ALM solutionUsing an acceptance test driven development approachUsing shared steps
Recording shared steps for fast forwardingDeveloping test cases in an evolutionary mannerUsing ordered test suites for long scenariosPutting everything together
Executing tests as part of the build process
Trang 18Using the right tests for the job
Chapter 16 Customizing and adding Help
Introduction
Help system overview
AX 2012 clientHelp viewerHelp serverAOS
Help content overview
TopicsPublisherTable of contentsSummary pageCreating content
Walkthrough: create a topic in HTMLAdding labels, fields, and menu items to a topicMake a topic context-sensitive
Update content from other publishersCreate a table of contents file
Creating non-HTML contentPublishing content
Add a publisher to the Web.config file
Publish content to the Help serverSet Help document set propertiesTroubleshooting the Help system
The Help viewer cannot display contentThe Help viewer cannot display the table of contents
PART III UNDER THE HOOD
Chapter 17 The database layer
Introduction
Temporary tables
Trang 19InMemory temporary tables TempDB temporary tables
Creating temporary tablesSurrogate keys
Performance considerationsUnit of Work
Chapter 18 Automating tasks and document distribution
Introduction
Batch processing in AX 2012
Common uses of the batch frameworkPerformance
Creating and executing a batch job
Creating a batch-executable class
Trang 20Creating a batch jobConfiguring the batch server and creating a batch groupManaging batch jobs
Debugging a batch taskPrint management in AX 2012
Common uses of print managementThe print management hierarchyPrint management settings
Chapter 19 Application domain frameworks
Introduction
The organization model framework
How the organization model framework worksWhen to use the organization model frameworkExtending the organization model frameworkThe product model framework
How the product model framework worksWhen to use the product model frameworkExtending the product model frameworkThe operations resource framework
How the operations resource framework worksWhen to use the operations resource frameworkExtending the operations resource frameworkMorphX model element prefixes for the operations resourceframework
The dimension framework
How the dimension framework worksConstraining combinations of valuesCreating values
Extending the dimension frameworkQuerying data
Physical table referencesThe accounting framework
Trang 21How the accounting framework worksWhen to use the accounting frameworkExtensions to the accounting frameworkAccounting framework process statesMorphX model element prefixes for the accountingframework
The source document framework
How the source document framework worksWhen to use the source document frameworkExtensions to the source document frameworkMorphX model element prefixes for the source documentframework
Chapter 21 Application models
Preparing a model for publication
Setting the model manifestExporting the model
Trang 22Signing the modelImporting model filesUpgrading a model
Moving a model from test to production
Creating a test environmentPreparing the test environmentDeploying the model to productionElement ID considerations
Model store API
Developing a mobile app
Platform options and considerationsDeveloper documentation and toolsThird-party libraries
Best practicesKey aspects of authenticationUser experience
Globalization and localizationApp monitoring
Web traffic debuggingArchitectural variations
On-corpnet appsWeb apps
Trang 23Data import and export
Test Data Transfer ToolData Import/Export FrameworkChoosing between the Test Data Transfer Tool and DIXFBenchmarking
Index
About the authors
What do you think of this book? We want to hear from you!
Microsoft is interested in hearing your feedback so we can continually improve our books and learning resources for you To participate in a brief online survey, please visit:
microsoft.com/learning/booksurvey
Trang 24The release of Microsoft Dynamics AX 2012 R3 and this book coincidewith the tenth anniversary of my involvement with the development of thisproduct I’ve had the pleasure to work with a great team of people
throughout that period When I reflect on the modest ambition we set outwith a decade ago, I’m excited to see all that we have achieved and amgrateful for all the support we received along the way from our customers,partners, and the community around this product
We set out to build a next-generation line-of-business system that
empowered people We wanted to go beyond traditional ERP in multipleways:
First and foremost was to create a system of empowerment, not asystem of records Microsoft Dynamics AX is designed to help
people do their jobs, not to record what they did after they did it Second, we wanted to maintain an agile system that allowed
businesses to change at their own pace and not at the pace of
previous generations of electronic concrete
Third, we wanted to provide functional depth and richness whilemaintaining simplicity of implementation, to allow both midsize andlarge organizations to use the same system
The embodiment of our first goal is role-tailored computing and
pervasive BI Those new to the Microsoft Dynamics AX community after
AX 2009 can’t imagine a day when that wasn’t a standard part of the
product AX 2012 takes that richness to a whole new level with more than
80 predefined security roles, and Role Centers for more than 40 distinctfunctions in an organization
The implementation of our second goal is in the richness of the AX
2012 metadata system and tools, combined with the fact that all of oursolutions and localizations are designed to work together AX 2012
enhances those capabilities even further while adding the organizationalmodel, self-balancing dimensions, date effectivity, and other powerfulapplication foundation elements
The realization of the third goal came in the form of deep industry
solutions for manufacturing, distribution, retail, service industries, and thepublic sector, along with a comprehensive set of life cycle services fordesign, development, deployment, and operations
Trang 25This book focuses on the enhancements to the Microsoft Dynamics AXdeveloper toolset and is written by the team that brought you those tools.It’s truly an insider’s view of the entire AX 2012 development and runtimeenvironment (now updated for the AX 2012 R3 release) I hope you enjoy
it as much as we enjoyed writing the book and creating the product
Here’s to the next ten years of our journey together
Thanks,
Hal Howard
Head of Product Development, Microsoft Dynamics AX
Corporate Vice President, Microsoft Dynamics Research and
Development
Trang 26Microsoft Dynamics AX 2012 represents a new generation of enterpriseresource planning (ERP) software With more than 1,000 new features andprebuilt industry capabilities for manufacturing, distribution, services,retail, and the public sector, AX 2012 provides a robust platform for
developers to deliver specialized functionality more efficiently to the
industries that they support AX 2012 is a truly global solution, able toscale with any business as it grows It is simple enough to deploy for asingle business unit in a single country, yet robust enough to support theunique requirements for business systems in 36 countries/regions—allfrom a single-instance deployment of the software With AX 2012 R3,Microsoft Dynamics AX delivers new levels of capability in warehouseand transportation management, demand planning, and retail
AX 2012 R3 also represents an important step forward in the evolution
of Microsoft Dynamics AX for the cloud As Microsoft Technical FellowMike Ehrenberg explains:
Microsoft is transforming for a cloud-first, mobile-first world As part of that transformation, with the AX 2012 R3 release, we are
certifying the deployment of Microsoft Dynamics AX on the
Microsoft Azure cloud platform, which uses the Azure
Infrastructure as a Service (IaaS) technology This opens up the
option for customers ready to move to the cloud to deploy the
power of Microsoft Dynamics AX to run their business; for
customers that favor on-premises deployment, it complements the option to harness the Microsoft Azure cloud platform for training, development, testing, and disaster recovery—all workloads with
the uneven demand that the cloud serves so well One of the most exciting new capabilities introduced with AX 2012 R3 is Lifecycle Services, our new Azure cloud-based service that streamlines
every aspect of the ERP deployment, management, servicing, and upgrade lifecycle—regardless of whether AX 2012 itself is
deployed on-premises or in the cloud We are leveraging the cloud
to deliver rapidly evolving services to help all of our customers
ensure that they are following best practices across their AX 2012 projects We are already seeing great results in rapid
deployments, streamlined support interactions, and performance
tuning—and this is only the beginning of our very exciting
Trang 27Customers have also weighed in on the benefits of Microsoft Dynamics
AX 2012:
Microsoft Dynamics AX 2012 allows us to collaborate within our
organization and with our constituents using built-in controls
and fund/encumbrance accounting capabilities to ensure
compliance with Public Sector requirements and using out-of
the-box Business Analytics and Intelligence so executives can
make effective decisions in real time.
Mike Bailey Director of Finance and Information Services
City of Redmond (Washington)
With AX 2012, developing for and customizing Microsoft
Dynamics AX will be easier than ever Developers will be able to
work with X++ directly from within Microsoft Visual Studio and
enjoy more sophisticated features in the X++ editor, for example Also, the release includes more prebuilt interoperability with
Microsoft SharePoint Server and SQL Server Reporting Services,
so that developers spend less time on mundane work when setting
up customer systems.
Guido Van de Velde Director of MECOMS™ Ferranti Computer Systems
AX 2012 is substantially different from its predecessor, which can mean
a steep learning curve for developers and system implementers who haveworked with previous versions However, by providing a broad overview
of the architectural changes, new technologies, and tools for this release,
the authors of Inside Microsoft Dynamics AX 2012 R3 have created a
resource that will help reduce the time that it takes for developers to
become productive
The history of Microsoft Dynamics AX
Historically, Microsoft Dynamics AX encompasses more than 25 years ofexperience in business application innovation and developer productivity.Microsoft acquired the predecessor of Microsoft Dynamics AX, calledAxapta, in 2002, with its purchase of the Danish company Navision A/S.The success of the product has spurred an increasing commitment of
Trang 28research and development resources, which allows Microsoft Dynamics
AX to grow and strengthen its offering continuously
The development team that created AX 2012 consists of three largeteams, two that are based in the United States (Fargo, North Dakota, andRedmond, Washington) and one that is based in Denmark (Copenhagen).The Fargo team focuses on finance and human resources (HR), the
Redmond team concentrates on project management and accounting andcustomer relationship management (CRM), and the Copenhagen teamdelivers supply chain management (SCM) In addition, a framework teamdevelops infrastructure components, and a worldwide distributed teamlocalizes the Microsoft Dynamics AX features to meet national regulations
or local differences in business practices in numerous languages and
markets around the world
To clarify a few aspects of the origins of Microsoft Dynamics AX, theauthors contacted people who participated in the early stages of the
Microsoft Dynamics AX development cycle The first question we askedwas, “How was the idea of using X++ as the programming language forMicrosoft Dynamics AX conceived?”
We had been working with an upgraded version of XAL for a while called OO XAL back in 1996/1997 At some point in time, we stopped and reviewed our approach and looked at other new languages like Java After working one long night, I decided that our approach had to change to align with the latest trends in programming languages, and
we started with X++.
Erik Damgaard Cofounder of Damgaard Data
Of course, the developers had several perspectives on this breakthroughevent
One morning when we came to work, nothing was working Later in the morning, we realized that we had changed programming
languages! But we did not have any tools, so for months we were
programming in Notepad without compiler or editor support.
Anonymous developer
Many hypotheses exist regarding the origin of the original product
name, Axapta Axapta was a constructed name, and the only requirementwas that the letter X be included, to mark the association with its
predecessor, XAL The X association carries over in the name Microsoft
Trang 29Dynamics AX.
Who should read this book
This book explores the technology and development tools in AX 2012through the AX 2012 R3 release It is designed to help new and existingMicrosoft Dynamics AX developers by providing holistic and in-depthinformation about developing for AX 2012—information that may not beavailable from other resources, such as SDK documentation, blogs, orforums It aids developers who are either customizing AX 2012 for a
specific implementation or building modules or applications that blendseamlessly with AX 2012 System implementers and consultants will alsofind much of the information useful
Assumptions
To get full value from this book, you should have knowledge of commonobject-oriented concepts from languages such as C++, C#, and Java Youshould also have knowledge of relational database concepts Knowledge ofStructured Query Language (SQL) and Microsoft NET technology is alsoadvantageous Transact-SQL statements are used to perform relationaldatabase tasks, such as data updates and data retrieval
Who should not read this book
This book is not aimed at those who install, upgrade, or deploy AX 2012
It is also beyond the scope of this book to include details about the sizing
of production environments For more information about these topics, refer
to the extensive installation and implementation documentation that issupplied with the product or that is available on Microsoft TechNet,
Microsoft Developer Network (MSDN), and other websites
The book also does not provide instructions for those who configureparameter options within AX 2012 or the business users who use the
application in their day-to-day work For assistance with these activities,refer to the help that is included with the product and available on TechNet
at http://technet.microsoft.com/en-us/library/gg852966.aspx
Organization of this book
Although Inside Microsoft Dynamics AX 2012 R3 does not provide
exhaustive coverage of every feature in the product, it does offer a broadview that will benefit developers as they develop for AX 2012
This book is divided into four sections, each of which focuses on AX
Trang 302012 from a different angle Part I, “A tour of the development
environment,” provides an overview of the AX 2012 architecture that hasbeen written with developers in mind The chapters in Part I also provide atour of the internal AX 2012 development environment to help new
developers familiarize themselves with the designers and tools that theywill use to implement their customizations, extensions, and integrations.Part II, “Developing for AX 2012,” provides the information that
developers need to customize and extend AX 2012 In addition to
explanations of the features, many chapters include examples, some ofwhich are available as downloadable files that can help you learn how tocode for AX 2012 For information about how to access these files, see the
“Code samples” section, later in this introduction
Part III, “Under the hood,” is largely devoted to illustrating how
developers can use the underlying foundation of the AX 2012 applicationframeworks to develop their solutions, with a focus on the database layer,system and application frameworks, reflection, and models
Part IV, “Beyond AX 2012,” focuses on developing companion apps formobile devices that allow AX 2012 users to participate in critical businessprocesses even when they are away from their computers It also describesexciting new techniques and tools, such as Lifecycle Services, that helppartners and customers manage every aspect of the application life cycle
Conventions and features in this book
This book presents information by using the following conventions, whichare designed to make the information readable and easy to follow
Application Object Tree (AOT) paths use backslashes to separate
nodes, such as Forms\AccountingDistribution\Methods.
The names of methods, functions, properties and property values,fields, and nodes appear in italics
Registry keys and T-SQL commands appear in capital letters
User interface (UI) paths use angle brackets to indicate actions—forexample, “On the File menu, point to Tools > Options.”
Boxed elements with labels such as “Note” provide additional
information or alternative methods for completing a step
successfully
Text that you type (apart from code blocks) appears in bold
A plus sign (+) between two key names means that you must pressthose keys at the same time For example, “Press Alt+Tab” means
Trang 31that you hold down the Alt key while you press the Tab key.
System requirements
To work with most of the sample code, you must have the RTM version of
AX 2012 installed For the Language-Integrated Query (LINQ) samples,you must be using AX 2012 R3 For information about the system
requirements for installing Microsoft Dynamics AX 2012, see the
Microsoft Dynamics AX 2012 Installation Guide at
http://www.microsoft.com/en-us/download/details.aspx?id=12687
You must also have an Internet connection to download the sample filesthat are provided as supplements to many of the chapters
Note
Some of the features described in this book, such as data
partitioning and the EP Chart Control, apply only to AX 2012
R2 and AX 2012 R3 That is noted where those features are
discussed
Code samples
Most of the chapters in this book include code examples that let you
interactively try out the new material presented in the main text You candownload the example code from the following page:
http://aka.ms/InsideDynaAXR3
Follow the instructions to download the 9780735685109_files.zip file.
Installing the code samples
Follow these steps to install the code samples on your computer:
1 Unzip the file that you downloaded from the book’s website.
2 If prompted, review the displayed end user license agreement If you
accept the terms, select the accept option, and then click Next
Note
If the license agreement doesn’t appear, you can access it
from the same webpage from which you downloaded the file
Trang 32Using the code samples
The code examples referenced in each chapter are provided as both xpofiles that you can import into Microsoft Dynamics AX and Visual Studioprojects that you can open through the corresponding csproj files Many
of these examples are incomplete, and you cannot import and run themsuccessfully without following the steps indicated in the associated
chapter
Acknowledgments
We want to thank all the people who assisted us in bringing this book topress We apologize for anyone whose name we missed
Microsoft Dynamics product team
Special thanks go to the following colleagues, whom we’re fortunate towork with
Margaret Sherman, whose Managing Editor duties included wranglingauthors, chasing down stray chapters, translating techno-speak into clearEnglish, keeping numerous balls in the air, and herding a few cats
Margaret kept the project moving forward, on schedule, on budget, andwith a real commitment to quality content Thank you, Margaret! Thisproject wouldn’t have happened without your leadership!
Mark Baker and Steve Kubis, who contributed ace project managementand editing work
Margo Crandall, who provided a quick and accurate technical review atthe last minute for Chapter 23
Hal Howard, Richard Barnwell, and Ann Beebe, who sponsored theproject and provided resources for it
We’re also grateful to the following members of the product team, whoprovided us with the reviews and research that helped us refine this book:Ned Baker
Trang 33(http://dynamicsaxbuild.codeplex.com/releases), with supporting
documentation on his blog (http://daxmusings.blogspot.com/), and hiscollaboration as we investigated this approach for executing SysTests fromMicrosoft Dynamics AX were valuable resources as we prepared the
chapter on testing
Microsoft Press
Another big thank you goes to the great people at Microsoft Press for theirsupport and expertise throughout the writing and publishing process
Carol Dillingham, the Content Project Manager for the book, who
provided ongoing support and guidance throughout the life of the project.Rosemary Caperton—Acquisitions Editor
Allan Iversen—Technical Reviewer
Kathy Krause—Project Editor and Copyeditor with Online TrainingSolutions, Inc (OTSI)
Errata, updates, & book support
We’ve made every effort to ensure the accuracy of this book If you
discover an error, please submit it to us via mspinput@microsoft.com You
Trang 34can also reach the Microsoft Press Book Support team for other supportvia the same alias Please note that product support for Microsoft softwareand hardware is not offered through this address For help with Microsoftsoftware or hardware, go to http://support.microsoft.com.
Free ebooks from Microsoft Press
From technical overviews to in-depth information on special topics, thefree ebooks from Microsoft Press cover a wide range of topics These
ebooks are available in PDF, EPUB, and Mobi for Kindle formats, readyfor you to download at:
http://aka.ms/mspressfree
Check back often to see what is new!
We want to hear from you
At Microsoft Press, your satisfaction is our top priority, and your feedbackour most valuable asset Please tell us what you think of this book at:
http://aka.ms/tellpress
We know you’re busy, so we’ve kept it short with just a few questions.Your answers go directly to the editors at Microsoft Press (No personalinformation will be requested.) Thanks in advance for your input!
Stay in touch
Let’s keep the conversation going! We’re on Twitter:
http://twitter.com/MicrosoftPress
This edition of the book is dedicated to Hal Howard, with many
thanks for your leadership.
—The Microsoft Dynamics AX Team
Trang 35Part I: A tour of the development
environmentCHAPTER 1 Architectural overview
CHAPTER 2 The MorphX development environment and tools CHAPTER 3 AX 2012 and NET
CHAPTER 4 The X++ programming language
Trang 36Chapter 1 Architectural overview
In this chapter
Introduction
AX 2012 five-layer solution architecture
AX 2012 application platform architecture
AX 2012 application meta-model architecture
Introduction
AX 2012 is an enterprise resource planning (ERP) solution that integratesfinancial resource management, operations resource management, andhuman resource management processes that can be owned and controlled
by multinational, multicompany, and multi-industry organizations,
including those in the public sector The AX 2012 solution encompassesboth the AX 2012 application and the AX 2012 application platform onwhich the application is built The application platform is designed to bethe platform of choice for developing scalable, customizable, and
extensible ERP applications in the shortest time possible, and for the
lowest cost The following key architectural design principles make thispossible:
Separation of concerns An AX 2012 end-to-end solution is
delivered by many development teams working inside Microsoft, inthe Microsoft partner channel, and in end-user IT support
organizations The separation of concerns principle realized in the
AX 2012 architecture makes this distributed development possible
by separating the functional concerns of a solution into five
globalized, secure layers This separation reduces functional overlapbetween the logical components that each team designs and
develops
Separation of processes An AX 2012 end-to-end solution scales to
satisfy the processing demands of a large number of concurrent
users The separation of processes principle that is realized in the AX
2012 architecture makes this scaling possible by separating
processing into three-tiers—a data tier, an application tier, and apresentation tier The AX 2012 Windows client, the Enterprise Portalweb client, and the Microsoft Office clients are components of thepresentation tier; the Application Object Server (AOS), the
Trang 37Enterprise Portal extensions to Microsoft SharePoint Server, andMicrosoft SQL Server Reporting Services (SSRS) are components ofthe application tier; SQL Server and SQL Server Analysis Services(SSAS) are components of the data tier.
Model-driven applications An AX 2012 application team can
satisfy application domain requirements in the shortest time possible.The model-driven application principle that is realized in the AX
2012 architecture makes this possible by separating
platform-independent development from platform-dependent development,and by separating organization-independent development from
organization-dependent development With platform-independentdevelopment, you can model the structure and specify the behavior
of application client forms and reports, application object entities,and application data entities that run on multiple platform
technologies, such as the AX 2012 Windows client, SharePoint
Server, SQL Server, and the Microsoft NET Framework With
organization-independent development, you can use domain-specificreference models such as the units of measure reference model;
domain-specific resource models such as the person, product, andlocation models; and domain-specific workflow models such as theapproval and review models, which are relevant to all organizations
AX 2012 five-layer solution architecture
The AX 2012 five-layer solution architecture, illustrated in Figure 1-1,logically partitions an AX 2012 solution into an application platform layer,
a foundation application domain layer, a horizontal application domainlayer, an industry application domain layer, and a vertical application
domain layer The components in all architecture layers are designed tomeet Microsoft internationalization, localization, and security standards,and all layers are built on the Microsoft technology platform
Trang 38FIGURE 1-1 AX 2012 five-layer architecture.
Note
The layers in the AX 2012 five-layer architecture are different
from the model layers that are part of the AX 2012
customization framework described later in this book
Architectural layers are logical partitions of an end-to-end
solution Customization layers are physical partitions of
application domain code For more information, see Chapter
The following logical partitions are layered on top of the Microsofttechnology platform:
Trang 39Layer 1: Application platform The application platform layer
provides the system frameworks and tools that support the
development of scalable, customizable, and extensible applicationdomain components This layer consists of the MorphX model–based development environment, the X++ programming language,the Windows client framework, the Enterprise Portal framework, theAOS, and the application platform system framework For a
description of the component architecture in the application platformlayer, see the “AX 2012 application platform architecture” sectionlater in this chapter
Layer 2: Foundation The foundation layer consists of
domain-specific reference models in addition to domain-domain-specific resourcemodeling, policy modeling, event documenting, and document
processing frameworks that are extended into organization
administration and operational domains Examples of
domain-specific reference models include the fiscal calendar, the operationscalendar, the language code, and the unit of measure reference
models Examples of domain-specific resource models include theparty model, the organization model, the operations resource model,the product model, and the location model The source documentframework and the accounting distribution and journalizing processframeworks are also part of this layer Chapter 19, “Application
domain frameworks,” describes the conceptual design of a number ofthe frameworks in this layer
Layer 3: Horizontal The horizontal layer consists of application
domain workloads that integrate the financial resource, operationsresource, and human resource management processes that can beowned and controlled by organizations Example workloads includethe operations management workload, the supply chain managementworkload, the supplier relationship management workload, the
product information management workload, the financial
management workload, the customer relationship management
workload, and the human capital management workload The AX
2012 application can be extended with additional workloads (Theworkloads that are part of the AX 2012 solution are beyond the
scope of this book.)
Layer 4: Industry The industry layer consists of application domain
workloads that integrate the financial resource, operations resource,and human resource management processes specific to organizations
Trang 40that operate in particular industry sectors Examples of industriesinclude discrete manufacturing, process manufacturing, distribution,retail, service, and public sector Workloads in this layer are
customized to satisfy industry-specific requirements
Layer 5: Vertical The vertical layer consists of application domain
workloads that integrate the financial resource, operations resource,and human resource management processes specific to organizationsthat operate in a particular vertical industry and to organizations thatare subject to local customs and regulations Example vertical
industries include beer and wine manufacturing, automobile
manufacturing, government, and advertising professional services.Workloads in this layer are customized to satisfy vertical industryand localization requirements
AX 2012 application platform architecture
The architecture of the AX 2012 application platform supports the
development of Windows client applications, SharePoint web client
applications, Office client integration applications, and third-party
integration applications Figure 1-2 shows the components that supportthese application configurations This section provides a brief description
of the application development environments, and a description of thecomponents in each of the data, middle, and presentation tiers of the AX
2012 platform architecture