Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

Опции темы Поиск в этой теме Опции просмотра
Старый 14.11.2012, 01:12   #1  
Blog bot is offline
Blog bot
25,491 / 846 (79) +++++++
Регистрация: 28.10.2006
ax_gfm_framework_team: The Microsoft Dynamics AX 2012 extension framework – Part 2

Arthur Greef and Michael Gall.

In this blog entry we examine the new extension framework that was shipped with Microsoft Dynamics AX 2012. In part 1 of this series, we explained how the extension framework can be used to instantiate objects from derived classes that are decorated with static class attributes. This design pattern should be used when derived class customizations are located in only one application object layer and if the customization does not change the class attribute specification that is used to annotate a derived class.

If a derived class is customized in more than one application object layer or in more than one application model, or if the class-attribute class specification is customized, then dynamic model element attributes must be used in place of static class attributes. This is because derived class customizations and class attribute customizations are merged at runtime.

This blog entry describes the model attribute design and shows how these attributes can be dynamically associated with application model elements at runtime. In the next blog entry, we’ll show how these dynamic attributes are used to dynamically extend the Microsoft Dynamics AX application.

There are two parts to this design. The first part describes how application model elements are identified by the extension framework, and the second part of the design describes how to dynamically associate dynamic attributes to these application model elements.

Model elements

The extension framework maintains a cache of model element objects that identify application object tree (AOT) model elements by name. Model elements are stored and retrieved by using a cache key that is composed of the application model element name and the classId of the SysExtModelElement base class or the classId of a class that is derived from the SysExtModelElement base class. Model elements identify run-time class specifications that can be decorated with model attributes. Model elements can either be -defined by a developer or they must reference any type of AOT object that can be identified with an AOT path. Note that all AOT model elements, not only classes, can be decorated with dynamic model elements.

Model attributes

A model element can be assigned one or more model attributes. Model elements themselves can serve as attributes as well. Model attributes have a name, and they have a property map that stores the name and the type of attribute properties. A model attribute instance is an instance of a model attribute with one or more property-value assignments. The extension framework provides a SysExtModelAttributeFactory for creating model attribute instances as shown in the following code example.

static void createAttributeInstance_Factory(Args _args)


SysExtModelAttributeInstance attributeInstance;

// Create an instance of a model attribute named‘String’ that

// comprises one property named ‘String’that is assigned the value ‘A’.

attributeInstance = SysExtModelAttributeInstanceFactory::newFromValue('A');


The following code example shows how custom attribute instances can be created. This example is for illustration only. The extension framework provides model attribute, property map, property-value map, and model attribute instance factory classes that should be used instead.

static void createAttributeInstance_Custom(Args _args)


SysExtModelAttribute attribute;

SysExtModelAttributeName attributeName;

SysExtModelPropertyName propertyName1, propertyName2;

SysExtModelAttributeInstance attributeInstance;

Map propertyMap;

Map propertyValueMap;

// Set the name of the attribute

attributeName = 'MyAttribute';

propertyName1 = 'MyProperty1';

propertyName2 = 'MyProperty2';

// Create property map

propertyMap = new Map(Types::String, Types::Enum);

propertyMap.insert(propertyName1, Types::String);

propertyMap.insert(propertyName2, Types::Integer);

attribute = SysExtModelAttribute::newFromParameters(attributeName, propertyMap);

// Create property map

propertyValueMap = new Map(Types::String, Types::Container);

propertyValueMap.insert(propertyName1, 'PropertyValue1');

propertyValueMap.insert(propertyName2, 2);

attributeInstance = SysExtModelAttributeInstance::newFromParameters(attribute, propertyValueMap);


Model element extensions

A dynamic and run-time model element extension is specified by binding a model element to one or more model attribute instances. Model element extensions are stored in the SysGlobalObjectCache.

The next blog entry (part 3) will demonstrate how the extension framework uses these model element extension objects for various dynamic and run-time extension scenarios.

Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 8 Blog bot Dynamics CRM: Blogs 1 30.04.2016 10:26
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 10 Blog bot Dynamics CRM: Blogs 0 17.08.2012 03:27
Sample Design Patterns: Book Give-away: 'Microsoft Dynamics AX 2012 Development Cookbook' Blog bot DAX Blogs 1 12.05.2012 16:55
dynamics-ax: Microsoft Highlights New ERP Public Sector Capabilities for AX 2012 Blog bot DAX Blogs 0 23.05.2011 19:11
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Часовой пояс GMT +3, время: 02:51.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.