Programming Fundamentals: Declaring Objects

Meta Data Services Programming

Meta Data Services Programming

Programming Fundamentals: Declaring Objects

When you program, you instantiate repository objects. Repository objects are COM objects that the repository engine creates on the fly using the type information and object instance data provided in your information model.

The repository object architecture divides objects into engine objects and information model objects. Programming against an information model typically requires that you invoke repository objects that are described by the repository engine object model. In contrast, when a model designer creates the type information, he or she typically uses Repository Type Information Model (RTIM) objects.

Declaring SpellChecker as RTIM Objects

For example, before you can use the following SpellChecker structure in your application code, the following declarations for SpellChecker must be predefined in your information model in some way that is compatible with the repository API. The following code example shows a hypothetical information model, MyTypeLib, and shows some additional definitions for SpellChecker that you can work with:

DIM oTypeLib as ReposTypeLib
DIM oCSpellChecker as ClassDef
DIM oISpellChecker as InterfaceDef
DIM oPLanguage as PropertyDef
Set oCSpellChecker = oTypeLib.CreateClassDef(CSC_objid, CSpellCheck, CSC_clsid)
Set oISpellChecker = oCSpellChecker.CreateInterfaceDef(ISC_objid, ISpellCheck, ISC_iid)
Set oPLanguage = oISpellChecker.CreatePropertyDef(PLang_objid, PLanguage, PLang_iid)
Declaring SpellChecker in Application Code

At a minimum, to retrieve meta data in your application code, you invoke a repository object that represents a repository session, another repository object that represents the repository type library containing your information model definitions, and additional repository objects that represent specific meta data instances.

Typically, to support versioning, you should use RepositoryObjectVersion. However, you can also use RepositoryObject as an alternative.

DIM oTypeLib as RepositoryObjectVersion
DIM oCSpellChecker as RepositoryObjectVersion
Dim oISpellChecker As ISpellChecker
oSpellChecker(oISpellChecker).Properties("Language")=French

See Also

Programming Fundamentals: Populating a Collection

Using Meta Data Services to Program Information Models