ax2012 enus wn dev 04

20
Chapter 4: Data Access CHAPTER 4: DATA ACCESS Objectives The objectives are: Learn about new features introduced in Microsoft Dynamics ® AX 2012 to support the data normalization initiative. Discuss date effectiveness and learn how to build date effective forms. Discuss the Unit Of Work concept and learn how to enable a group of tables to be treated as a single transaction. Discuss additional improvements made to the data access framework including, Temp DB tables, data caching, query framework, full-text search and effects of disabling tables. Discuss events and how events allow you to decouple custom code from the implementation of the underlying layer. Introduction This chapter provides a basic overview of the new technical features in Microsoft Dynamics AX 2012 and discusses the following new and improved concepts: Relational Modeling Date Effectiveness Unit Of Work Eventing Data Access Framework 4-1 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Upload: silvia-bedejova

Post on 27-Sep-2015

9 views

Category:

Documents


5 download

TRANSCRIPT

  • Chapter 4: Data Access

    CHAPTER 4: DATA ACCESS Objectives

    The objectives are:

    Learn about new features introduced in Microsoft Dynamics AX 2012 to support the data normalization initiative.

    Discuss date effectiveness and learn how to build date effective forms.

    Discuss the Unit Of Work concept and learn how to enable a group of tables to be treated as a single transaction.

    Discuss additional improvements made to the data access framework including, Temp DB tables, data caching, query framework, full-text search and effects of disabling tables.

    Discuss events and how events allow you to decouple custom code from the implementation of the underlying layer.

    Introduction This chapter provides a basic overview of the new technical features in Microsoft Dynamics AX 2012 and discusses the following new and improved concepts:

    Relational Modeling Date Effectiveness Unit Of Work Eventing Data Access Framework

    4-1

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • What's New - Technical in Microsoft Dynamics AX 2012 for Development

    Relational Modeling As part of data normalization in Microsoft Dynamics AX 2012 multiple new features, grouped under the Relational modeling concept, are introduced to improve the following:

    Data normalization o Support surrogate keys o Support table graph to enable a single database transaction for

    normalized tables o Support table inheritance

    Support date effectiveness Support relationship defined at the table level instead of at Extended

    Data Types (EDT)

    NOTE: The ability to define relations on EDTs is removed in Microsoft Dynamics AX 2012.

    Table Inheritance

    Just as an X++ class can inherit from another class, in Microsoft Dynamics AX 2012 a table can inherit from another table. As in earlier releases, the Common table is still the base table for every table. A table that inherits from the base table is called a derived table.

    NOTE: In Microsoft Dynamics AX 2012 the terms parent table and child table are used to describe foreign key relationships, not inheritance.

    In Microsoft Dynamic AX 2012, various new and refactored tables will be using base and derived tables instead of normal relations to support table inheritance. The table inheritance improvement is a central framework and is supported in all framework components. It is model driven and is adapted in the query and X++ language extensions.

    This feature enables a developer to build forms that contain base and derived tables. Forms binding to base tables enable displaying, creating, editing, or deleting data from all the derived tables.

    4-2

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • Chapter 4: Data Access

    Table Inheritance Terminology

    Microsoft Dynamics AX 2012 introduces the following new terminology:

    Term Definition Derived Table Table which has the Extends property set to reference

    another table.

    Base Table Table which is referenced by the BaseTable property of another table.

    Derived DataSource

    DataSource that is generated to show the derived tables under a FormDataSource that has derived tables.

    Derived Field Bound Control

    Control bound to a derived field which is defined on the Derived FormDataSource

    Base Field Bound Control

    Control bound to a base field which is defined on the FormDataSource.

    Polymorphic Form

    Form that contains data from more than one table type because of a base and derived relation.

    Surrogate Key

    A surrogate key is a system generated value that acts as the primary key of a table. This value is typically used instead of a set of fields called the natural key which would typically act as the primary key of a table. Microsoft Dynamics AX 2012 uses RecId as the surrogate key.

    In earlier versions of Microsoft Dynamics AX the client supports lookup controls where the forms table contains alternate foreign keys. Because the natural foreign key is contained on the forms table, no additional query joins are needed to obtain an end-user understandable value. In Microsoft Dynamics AX 2012 new and refactored tables will be using the RecId surrogate key as their primary key, replacing the keys that contain user understandable values. The form must be changed to join to the related table to retrieve the user understandable data.

    The surrogate key feature enables the client to maintain lookup control behavior by replacing the surrogate foreign key value with values from the related table. From a user experience perspective this feature maintains the same functionality with surrogate foreign key lookups as already exists with natural foreign key lookups.

    4-3

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • What's New - Technical in Microsoft Dynamics AX 2012 for Development

    Surrogate Key Terminology

    The Microsoft Dynamics AX 2012 surrogate concept introduces the following new terminology:

    Term Definition Reference DataSource

    Read-only FormDataSource that is outer-joined to its parent FormDataSource.

    Reference DataSource Field

    Field on a Reference DataSource.

    Surrogate Key

    A system generated value that acts as the primary key of a table. This value is typically used instead of a set of fields called the natural key which would typically act as the primary key of a table. Microsoft Dynamics AX 2012 uses RecId as the surrogate key.

    Replacement Key

    A set of fields derived from application data that form a candidate key and uniquely identify a row. The natural key is not guaranteed to be user readable or appropriate for the user interface.

    Surrogate Foreign Key

    Relation referencing a table by using a surrogate key as its primary key.

    Replacement Foreign Key

    Table field containing a replacement key value which links the current record to the related record.

    AutoIdentification Field Group

    A new system created field group that is populated by the developer or system with fields that form the default surrogate key replacement fields.

    Surrogate key replacement fields

    A set of user readable fields that are displayed instead of the surrogate foreign key. Client forms will use joined data sources to retrieve these fields at query time. The set of fields to use will be defined by a property on the new reference group control.

    Reference Group

    Control to display the surrogate foreign key.

    Scenario: Create Table Relation

    In Microsoft Dynamics AX 2009, the Party tables use normal relations instead of base and derived table types. With Microsoft Dynamics AX 2012 supporting table inheritance, Isaac wants to take advantage of this modeling capability.

    4-4

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • Chapter 4: Data Access

    Isaac has to create a form which enables the user to view, create, edit, and delete either a Person or an Organization in a single form. Isaac has created one table named Party, and two derived tables named Organization and Person. The two derived tables are based on the Party table. The Organization table is also a base table because it is extended by two derived tables: NonProfitOrganization and GovernmentOrganization.

    He has to create a list page which displays all the parties. Each row must link to a different detail page. The user must be able to create any of the derived types from this list page such as Person, Organization, NonProfileOrganization and GovernmentOrganization

    Procedure: Create Table Relation

    To create a base and derived table relation, follow these steps:

    1. Open the Application Object Tree (AOT). 2. Optional: Review the DirPartyTable, DirPerson and DirOrganization

    table and table relations and table inheritance. 3. Create a new form named DirPartyForm. 4. Drag the DirPartyTable table to the PartyForm DataSources

    collection. 5. Make sure that the AOT creates a FormDataSource named

    DirPartyTable. 6. Set the Name property to DirPartyTable and the Table property to

    DirPartyTable. 7. Make sure that the AOT creates the derived data sources

    DirPartyTable_DirPerson and DirPartyTable_DirOrganizationBase under the Derived DataSources collection.

    8. Create a Grid control on the Form Design. 9. Drag the DirPartyTable data source Name field onto the grid

    control. 10. Drag the DirPartyTable_OrganizationBase fields onto the grid

    control. 11. Drag the DirPartyTable_Person fields onto the grid control. 12. Open the form to show that organizational and personal information

    is displayed in the grid.

    Date Effectiveness Date effectiveness is an ability of the application to associate valid from and to dates with the application artifacts. For example, an agreement can be valid between a range of dates; similarly interest rates are assigned based on start date and end date association.

    4-5

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • What's New - Technical in Microsoft Dynamics AX 2012 for Development

    The date effectiveness feature is a central framework that is supported in all framework components. It helps developers write less but more consistent code. Also it provides the functionality to create forms that manage editing of past, current and future records.

    Scenario: Create a Data Effective Table

    Isaac, the Developer, wants to build a table to hold positions for an employee. The positions are for a specific time frame and Isaac does not enable time gaps between positions held by an employee.

    Procedure: Create a Data Effective Table

    To create a table that is enabled for date effectiveness and does not enable date gaps, follow these steps:

    1. Open the AOT. 2. Create a project. 3. Create a new Table. 4. Right-click the table and select Properties. 5. Enter Date in the ValidTimeStateFieldType property. 6. Verify the ValidFrom and ValidTo date fields are created. 7. Drag the additional AOT Extended Data Type objects under the

    Field node on the new table. 8. Right-click the Indexes node and select New Index. 9. Drag the required fields to the new index node. 10. Right-click the new index and select Properties. 11. Set AllowDuplicates to No. 12. Set AlternateKey, and ValidTimeStateKey to Yes. 13. Set ValidTimeStateMode to NoGap. 14. Save the table.

    Procedure: Demonstrate Date Gap

    To demonstrate the date effectiveness and make sure the table does not enable date gaps, follow these steps

    1. Open the AOT. 2. Select the table that is created in the "Create a Data Effective Table"

    procedure. 3. Right-click the table. 4. Select Add-ins > Table Browser to open the table. 5. Enter a record with a From date and To date. 6. Enter a second record for the same employee but with a From date

    and To date starting some days after the To date of the first record.

    4-6

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • Chapter 4: Data Access

    7. Click Save. 8. Click Yes and accept the adjustment to the effective dates. 9. Verify the system changed the first record and adjusted the To date

    to fill the gap between the two records.

    Procedure: Demonstrate Date Overlap

    To demonstrate the date effectiveness and to make sure that the table does not enable date overlaps, follow these steps:

    1. Open the AOT. 2. Select the table created in the previous procedure. 3. Right-click the table. 4. Select Add-ins > Table Browser to open the table. 5. Enter a third record for the same employee as in the previous

    procedure but with a From date and To date overlapping the second records time frame.

    6. Click Save. 7. Click Yes and accept the adjustment to the effective dates. 8. Verify the system changes the second record and adjusted the To

    date to resolve the date overlap.

    4-7

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • What's New - Technical in Microsoft Dynamics AX 2012 for Development

    Lab 4.1 - Create a Date Effective Form This lab demonstrates how to create a table that is enabled for date effectiveness.

    Scenario

    Isaac, the Developer, wants to build a table to hold positions for an employee. The positions are for a specific time frame and Isaac does not enable time gaps between positions held by an employee.

    Challenge Yourself!

    Use the information that is provided to develop a table to hold positions for an employee. The positions are for a specific time frame. The system does not enable time gaps between positions held by an employee.

    Need a Little Help?

    1. Create a project. 2. Create a new Table named PositionEmployee. 3. Set the table properties to enable date effectiveness with gaps, and

    create the index. 4. Create three records to demonstrate the date overlap. 5. Make sure that the system adjusted the records to resolve the date

    conflicts.

    Step by Step: Create a Date Effective Table

    1. Open Microsoft Dynamics AX 2012. 2. Open a Developer workspace. 3. Open the AOT. 4. Create a new Table named PositionEmployee. 5. Right-click the table and select Properties. 6. Enter Date in the ValidTimeStateFieldType property. 7. Drag the AOT Extended Data Type objects Position and EmplId

    under the Field node on the new table. 8. Right-click the Indexes node and select New Index. 9. Drag the EmplId, ValidTo, and ValidFrom field to the new index

    node. 10. Right-click the new index and select Properties. 11. Enter EmplIdx into the Name property. 12. Set AllowDuplicates to No. 13. Set AlternateKey, and ValidTimeStateKey to Yes. 14. Set ValidTimeStateMode to NoGap. 15. Save the table.

    4-8

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • Chapter 4: Data Access

    Step by Step: Demonstrate Date Gap

    1. Select table PositionEmployee. 2. Right-click the table. 3. Select Add-ins > Table Browser to open the table. 4. Enter a record with a From date and To date. 5. Enter a second record for the same employee but with a From date

    and To date starting some days after the To date of the first record. 6. Click Save. 7. Click Yes and accept the adjustment to the effective dates. 8. Verify the system changes the first record and adjusted the To date

    to fill the gap between the two records.

    Step by Step: Demonstrate Date Overlap

    1. Select table PositionEmployee. 2. Right-click the table. 3. Select Add-ins > Table Browser to open the table. 4. Enter a third record for the same employee as in the previous

    procedure but with a From date and To date overlapping the second records time frame.

    5. Click Save. 6. Click Yes and accept the adjustment to the effective dates. 7. Verify the system changed the second record and adjusted the To

    date to resolve the date overlap.

    4-9

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • What's New - Technical in Microsoft Dynamics AX 2012 for Development

    Unit Of Work Microsoft Dynamics AX 2012 enables the developer to group tables so they are treated as one single transaction. This concept, called Unit of Work, allows the developer to have one single trip to the Application Object Server (AOS) to change multiple records.

    Form

    In earlier releases of Microsoft Dynamics AX, forms provided limited support for treating a group of tables as a single transaction. Form behavior involved each table being individually sent to the AOS to change the database. As part of the effort to support normalizing tables, the Unit Of Work feature supports saving multiple tables in a single transaction on a form.

    It supports inner and outer joined tables for a single query row to be treated as a single Unit of Work. Because of the current Form DataSource and Table method ordering, new methods will be introduced to allow for separation of the client-side logic executed before and after the call to the server.

    NOTE: The Unit Of Work feature supports client form ONE-TO-ONE relationship joins.

    Business Logic

    Use the Unit Of Work class to manage the:

    Operation sequence and transaction integrity for your row-by-row database deletes, inserts, and updates.

    Key propagation between the tables, and proper rollback if transactions fail.

    NOTE: The Unit Of Work feature supports the X++ ONE-TO-ONE relationship and ONE-TO-MANY relationship joins.

    Data Access Framework This section provides a basic overview of the additional improvements to the data access framework including the following:

    TempDB Temporary Tables Disabling a Table Data Caching Expression Operations for Inheritance Query Framework Full Text Index

    4-10

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • Chapter 4: Data Access

    Computed Columns in Views Object ID

    TempDB Temporary Tables

    In Microsoft Dynamics AX 2012 a new type of temporary table is available. In the AOT properties for a table, the TableType property is now a drop-down menu with several options. The enum value InMemory is the legacy type of temporary table that is hosted in the client. The enum value TempDB is the new type of temporary table that is hosted in the underlying Microsoft SQL Server database. TempDB temporary tables can be joined on the database tier with regular tables.

    FIGURE 4.1 TABLES TYPES

    Disabling a Table

    In Microsoft Dynamics AX 2012, when the configuration key for a table that is listed in the AOT is disabled, the corresponding table in the underlying database management system is not dropped. In the earlier version of Microsoft Dynamics AX when changing the configuration key to disable a table, the table is dropped from the SQL database, deleting all data in the table. Keeping the data in disabled tables enables External applications and Microsoft SQL Server cubes to read the data from the table because they bypass the AOS.

    Data Caching

    As part of data normalization in Microsoft Dynamics AX 2012 and the introduction of table inheritance, surrogate key and date effectiveness, data caching is improved to support the following:

    Global object cache Date effective join cache

    4-11

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • What's New - Technical in Microsoft Dynamics AX 2012 for Development

    Unique index cache extension Cache lookup for table groups

    Expression Operators for Inheritance

    The X++ language now has the expression operators is and as. You can use the is operator to test whether an object is, either directly or by inheritance, of a given type. The as operator is similar to the is operator, the difference is the return value:

    IS returns a Boolean AS returns NULL or the designated value as the designated type

    Query Framework

    Use the new QueryFilter class to filter the result set from an outer join. The QueryFilter class produces different results than the QueryBuildRange class in outer joins. The results are different because the QueryFilter class filters later in the internal query process and helps prevent rows with null values from appearing in the result set.

    BEST PRATICE: Use QueryFilter instead of QueryRange for form queries because it produces the correct result regardless of join type.

    Full Text Index

    Microsoft Dynamics AX 2012 provides full-text functionality that enables Microsoft Dynamics AX to search business data over a large volume of text data or documents. You can create a full-text index on tables of type Main and Group.

    NOTE: You must configure the SQL Server full-text search functionality before you use it in the Microsoft Dynamics AX application.

    Same as regular SQL Server indexes, full-text indexes can be automatically updated at the same time that the data is changed in the associated tables. This is the default behavior for Microsoft Dynamics AX. In the AOT, developers can set the ChangeTracking property of a full-text index to either Auto or Manual. Indexes with the Auto property are updated automatically by the SQL Server as data is changed in associated tables. Indexes with the Manual property must be manually updated at a specified interval. The ChangeTracking property defaults to Auto for a new full-text index. Use the ChangeTracking property for optimum response time and throughput for the Microsoft Dynamics AX application.

    4-12

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • Chapter 4: Data Access

    Computed Columns in Views

    In Microsoft Dynamics AX 2012 a view can have a computed column. A computed column is the output of a computation that inputs a regular column.

    FIGURE 4.2 COMPUTED COLUMN PROPERTIES

    NOTE: The computed Qty field is given by the ViewMethod called Qty.

    Object ID

    In earlier releases of Microsoft Dynamics AX, the number of object IDs available for application elements was limited, both in the range of IDs and by layer. In Microsoft Dynamics AX 2012, the 16 byte object ID is upgraded to 32 bytes. This change exponentially increases the number of object IDs.

    Eventing Microsoft Dynamics AX 2012 introduces the concept of events which lets the user use a publisher and subscriber model when manifesting changes occurring in the X++ application. Events can be modeled in metadata or be used as a programming construct and can be handled in either X++ code or in managed code.

    NOTE: Modeled events are only available on classes and not tables or forms.

    4-13

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • What's New - Technical in Microsoft Dynamics AX 2012 for Development

    Overview

    The current Microsoft Dynamics AX architecture includes application layers that can be customized in upper layers. For example, when Microsoft ships a class in the SYS layer, a developer can change the class in an upper layer such as the CUS layer. At run time, the X++ language engine will select the appropriate version to run based on the layer of the current user. Using events enable you to decouple the custom code from the implementation of the underlying layer. The application developers from a lower level can freely change the implementation at any time without the developers of the upper layer having to make any changes to his or her code, as long as the modified code author raises the same events in the same order. Basically, the application developers build an API enabling customization through events.

    Benefits

    The main reasons for introducing events are:

    Observation: This paradigm is concerned with looking for exceptional behavior and generating alerts when such behavior occurs. One example is regulation compliance systems. If more than a designated amount is transferred from one account to another, it triggers a workflow that asks for acceptance of the transaction.

    Information Dissemination: This paradigm is about delivering the appropriate information to the appropriate consumers at the right time. Events are published to anyone that wants to react to it.

    Decoupling: The events produced by one part of the application can be consumed by a completely different part. There is no need for the producer to be aware of the consumers, nor do the consumers need to know details about the producer. The event produced can be acted upon by any number of consumers. On the other hand, consumers can act upon any number of events from many different producers. This helps developers with code upgrade and custom modifications.

    Eventing Terminology

    Microsoft Dynamics AX 2012 events are modeled after the .NET event concepts and introduce the following new terminology:

    Term Definition Producer The producer is the logic that contains the code that causes a

    change. This means that it is the entity that emits events.

    Consumer The consumer is the application code that has manifested an interest in being notified when a specific event occurs. This means that it is an entity that receives events.

    Event An event is a representation of a change happening in the producer. Microsoft Dynamics AX 2012 supports Pre and Post events that occur before and after a method is called.

    4-14

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • Chapter 4: Data Access

    4-15

    Term Definition Event Payload

    The event payload is the information that the event carries with it. If a person is hired, for example, the payload includes the employee's name and date of birth, and so on.

    Delegate A delegate is the definition of the information passed from the producer to the consumer when an event happens.

    Event Handlers

    Event handlers are methods that are called when the delegate is called, either directly through code (for the coded events) or from the environment (for the modeled events). The relationship between the delegate and the handlers can be maintained in code or in the AOT.

    The X++ language now features the delegate keyword. When program conditions meet the programmer's criteria for the event, the X++ code can call the delegate, and that causes the delegate to call all the event handler methods that are added to the delegate.

    To create a delegate, right-click the class and select New > Delegate.

    Adding Handlers in the AOT

    The user must identify a static method to handle the event on the delegate. However, when adding event handlers from code, described in the following material, instance methods are also applicable as event handlers. Event handlers can be added to the delegate by dragging the event handler to the delegate node that represents the event to be handled. The handler can be removed using the delete menu item available for any node in the AOT.

    Use special X++ syntax to remove or add event handlers to events. The delegate name appears on the left side of the += operator. On the right side the keyword event handler is given, together with the eventhandler keyword and the qualified name of the handler to add. The compiler will make sure that the parameter profiles of the delegate and the handler match.

    private void AddStaticHandler() { ; this.MyDelegate += eventhandler (Subscriber::MyHandler); }

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • What's New - Technical in Microsoft Dynamics AX 2012 for Development

    Pre and Post Events

    You can subscribe an event handler to automatically run immediately before a method is run. The event handler can change the parameter values before they are passed into the method. You can also subscribe an event handler to run immediately after a method is run. The event handler can change the value that is returned by the method, before the return value is received by the caller of the method.

    Event handlers for these pre and post events are visible in the AOT as sub nodes on the methods to which they apply.

    Summary This chapter discussed multiple new features that were introduced as part of the data normalization in Microsoft Dynamics AX 2012. The features focus on improvements in developer productivity, end-user experience and total cost of ownership.

    This chapter also discussed the following new and improved concepts:

    Table inheritance. Surrogate key support. Date effectiveness. Unit Of Work class to enable a single database transaction for

    normalized tables. Data access framework improvements including TempDB tables,

    data caching, query framework, full text index and effects of disabling tables.

    Eventing to enable the use of a publisher and subscriber model when manifesting changes occurring in the X++ application.

    4-16

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • Chapter 4: Data Access

    Test Your Knowledge

    1. Date effectiveness is the ability of the application to associate valid from and to dates with the application artifacts. Which of the following are valid statements in regards to data effectiveness? (Select all that apply)

    ( ) Developers can create forms that show only current, past or future records.

    ( ) The system automatically resolves date issues if there is gap between time frames.

    ( ) The system automatically resolves date issues if there are overlaps between time frames.

    ( ) The system automatically determines the most effective time duration for a position held by an employee.

    2. Which of the following concepts enable a group of tables to be treated as a single transaction?

    ( ) Developers can group multiple table changes into a single trip to the AOS by using the Unit Of Work class.

    ( ) Developers can group multiple table changes into a single trip to the AOS by wrapping the transactions in a TTSbegin and TTSCommit block.

    ( ) Developers can group multiple table changes into a single event. Therefore eventing treats a group of tables as a single transaction.

    3. Which of the following are improvements to the data access framework in Microsoft Dynamics AX 2012? (Select all that apply)

    ( ) The TempDB temporary table is hosted in the underlying Microsoft SQL Server database.

    ( ) Disabling the configuration key for a table that is listed in the AOT does not drop the table in the SQL Database.

    ( ) Unlike regular SQL Server indexes, full-text indexes must be manually updated at the same time as data is changed in the associated tables.

    ( ) The X++ language now has the expression operators is and as

    4. Which of the following is a true statement in regards to eventing?

    ( ) Events can be handled in either X++ code or in managed code. ( ) Events can be handled in X++ code only. ( ) Events can be handled in managed code only. ( ) Events cannot be handled in X++ code or in managed code. Events

    are a business concept under the Human Resources (HR) module.

    4-17

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • What's New - Technical in Microsoft Dynamics AX 2012 for Development

    Quick Interaction: Lessons Learned Take a moment and write down three key points you have learned from this chapter

    1.

    2.

    3.

    4-18

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • Chapter 4: Data Access

    Solutions Test Your Knowledge

    1. Date effectiveness is the ability of the application to associate valid from and to dates with the application artifacts. Which of the following are valid statements in regards to data effectiveness? (Select all that apply)

    () Developers can create forms that show only current, past or future records.

    () The system automatically resolves date issues if there is gap between time frames.

    () The system automatically resolves date issues if there are overlaps between time frames.

    ( ) The system automatically determines the most effective time duration for a position held by an employee.

    2. Which of the following concepts enable a group of tables to be treated as a single transaction?

    () Developers can group multiple table changes into a single trip to the AOS by using the Unit Of Work class.

    ( ) Developers can group multiple table changes into a single trip to the AOS by wrapping the transactions in a TTSbegin and TTSCommit block.

    ( ) Developers can group multiple table changes into a single event. Therefore eventing treats a group of tables as a single transaction.

    3. Which of the following are improvements to the data access framework in Microsoft Dynamics AX 2012? (Select all that apply)

    () The TempDB temporary table is hosted in the underlying Microsoft SQL Server database.

    () Disabling the configuration key for a table that is listed in the AOT does not drop the table in the SQL Database.

    ( ) Unlike regular SQL Server indexes, full-text indexes must be manually updated at the same time as data is changed in the associated tables.

    () The X++ language now has the expression operators is and as 4. Which of the following is a true statement in regards to eventing?

    () Events can be handled in either X++ code or in managed code. ( ) Events can be handled in X++ code only. ( ) Events can be handled in managed code only. ( ) Events cannot be handled in X++ code or in managed code. Events

    are a business concept under the Human Resources (HR) module.

    4-19

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

  • What's New - Technical in Microsoft Dynamics AX 2012 for Development

    4-20

    Microsoft Official Training Materials for Microsoft Dynamics

    Your use of this content is subject to your current services agreement

    Chapter 4: DATA ACCESSObjectivesIntroductionRelational ModelingTable InheritanceTable Inheritance TerminologySurrogate KeySurrogate Key TerminologyScenario: Create Table RelationProcedure: Create Table Relation

    Date EffectivenessScenario: Create a Data Effective TableProcedure: Create a Data Effective TableProcedure: Demonstrate Date GapProcedure: Demonstrate Date Overlap

    Lab 4.1 - Create a Date Effective FormScenarioChallenge Yourself!Need a Little Help?Step by Step: Create a Date Effective TableStep by Step: Demonstrate Date GapStep by Step: Demonstrate Date Overlap

    Unit Of WorkFormBusiness Logic

    Data Access FrameworkTempDB Temporary TablesDisabling a TableData CachingExpression Operators for InheritanceQuery FrameworkFull Text IndexComputed Columns in ViewsObject ID

    EventingOverviewBenefitsEventing TerminologyEvent HandlersAdding Handlers in the AOTPre and Post Events

    SummaryTest Your KnowledgeQuick Interaction: Lessons LearnedSolutions