Skip to main content


abstract class %ZHSLIB.Context.NamedInstanceBase extends %Library.RegisteredObject

Property Inventory

Method Inventory


final parameter Global = ^IRIS.Temp.ZHSLIB.NamedInstance;


property InstanceKey as %String;
The 'instance key' used to acquire this instance object
Property methods: InstanceKeyDisplayToLogical(), InstanceKeyIsValid(), InstanceKeyLogicalToDisplay(), InstanceKeyLogicalToOdbc(), InstanceKeyNormalize(), InstanceKeySet()


classmethod %%CheckSubClassValidity()
Ensure non-abstract subclasses have abstract parameters defined correctly
method %OnNew(pKey As %String) as %Status
Inherited description: This callback method is invoked by the %New() method to provide notification that a new instance of an object is being created.

If this method returns an error then the object will not be created.

It is passed the arguments provided in the %New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from %New(). For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:

Method %OnNew(dob as %Date = "", name as %Name = "") as %Status If instead of returning a %Status code this returns an oref and this oref is a subclass of the current class then this oref will be the one returned to the caller of %New method.

classmethod EnsureInstance(pKey As %String) as %ZHSLIB.Context.NamedInstanceBase
This method is called to acquire a specific Named instance of a service. The service instance may have been previously registered with the Context using RegisterNamedInstance. First the Context object is called to attempt to acquire a previously registered instance. If the instance is present and its class has not be re-compiled since it was registered, then the registered instance is returned. Otherwise, the subclass implementation of CreateInstance is called to acquire and register an instance.
method InstanceKeyGet() as %String
Implement Get for the Calculated 'Instance' property
classmethod InvalidateAllInstances()
This method will ensure that, for all named instances registered with this class, a new service will be instantiated and initialized the next time EnsureInstance is called. This may be used after making changes which affect all keys registed from a class, rather than just a single key (which could use the InvalidateInstances method).
classmethod InvalidateInstances(pKey As %String)
Calling this method ensures that the next time EnsureInstance is called, a new service will be instantiated and initialized. Call this method after changing settings that the service caches in order to have the setting take effect.
classmethod SetDebugMode(pKey As %String, newMode As %Boolean)
This method provides control of debug mode. When in debug mode, the EnsureInstance method will always force a CreateInstance. This is useful during the development of a service, but adds overhead in production because the service instance is created and initialized on each request.
classmethod fullKey(pKey As %String) as %String

Inherited Members

Inherited Methods

FeedbackOpens in a new tab