Modeling Services > Dynamic Modeling Services > How to Use Dynamic Objects > Creating Dynamic Objects
 
Creating Dynamic Objects
A dynamic object can be created in four ways:
*from a component request using a dynamic view;
*from the C++ static member function IlsDynObject::NewInstance;
*from a script function using the object constructor;
*from C++ user code, by using a subclass constructor, if you have derived your subclass from the class IlsDynObject.
Each time an instance of a dynamic type must be created, Rogue Wave® Server instantiates the class IlsDynObject or a subtype. The dynamic object must then be associated with an instance of IlsObjectType from which it will read its description dynamically, building its dynamic attributes and relations from this description. In other words, the internal structure of the object results from the associated IlsObjectType object which acts as a template for this type. If a dynamic type inherits from another type, more than one instances of IlsObjectType may be involved to build the internal structure. See Inheritance from a Static Type to a Dynamic Type for additional information.
When a dynamic object is built, the following actions are performed:
1. An instance of IlsDynObject is built using the class IlsDynObjectFactory. If the dynamic type inherits from a static type, an instance of this static type is built.
Note: If a static type exists in the inheritance path, the corresponding constructor will be called with the identifier as its argument.
2. The virtual function IlsDynObject::initObject is called to build the internal structure.
3. The virtual function IlsDynObject::afterInit is called.

Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.