The following interfaces are used to implement dynamic properties:
Each of the first three pairs listed above shows a legacy interface name followed by its more modern counterpart. All these interfaces are still valid, but the scope of the older versions is more limited. IDynamicProperty, IPropertyManager, and IDynamicPropertyNotify interfaces work only with entities. IDynamicProperty2, IPropertyManager2, and IDynamicPropertyNotify2 interfaces can define and manage properties for both entities and objects.
The IDynamicProperty and IDynamicProperty2 interfaces enable you to define runtime properties. You derive a class from one of these interfaces for each dynamic property you wish to display in the Properties palette. The Property Inspector calls the methods of your derived class to get the information it needs to display the property.
Before your properties can be associated with objects, however, they must be attached to an AcRxClass object. This is done through IPropertyManager, IPropertyManager2, and IPropertySource implementations. Each of these interfaces manages links between objects and AcRxClass instances, but they do so in varying ways. Figure 5 shows the interaction and multiplicities between dynamic property objects, managers, and sources, and AcRx classes.
Each instance of IPropertyManager or IPropertyManager2 represents a single AcRxClass. Dynamic properties register themselves with one or more IPropertyManager or IPropertyManager2 instances, thus binding themselves to the AcRxClass instances. IPropertyManager deals with pointers to IDynamicProperty instances only, and thus handles dynamic properties only for database-resident entities. IPropertyManager2 accepts and returns IUnknown pointers to IDynamicProperty or IDynamicProperty2 instances. By supporting IDynamicProperty2, IPropertyManager2 extends dynamic property management to non-database-resident objects.
Figure 5 - Dynamic property mechanism
IPropertySource objects generate dynamic properties upon request, based on the objects that are passed to them. Properties generated by IPropertySource objects are known as “per-instance” dynamic properties. However, a related object instance is not required. An IPropertySource object can provide properties to the Property Inspector even if a null object is passed to it.
Because per-instance properties are instantiated at runtime on a per-object basis, the properties are not registered with any manager object. Rather, the IPropertySource object that generates them is registered with an OPMPerInstancePropertyExtension object which, in turn, is associated with an AcRxClass. Per-instance dynamic properties are discussed further in the section titled Implementing Per-Instance Dynamic Properties.