Programming Fundamentals: Populating a Collection

Meta Data Services Programming

Meta Data Services Programming

Programming Fundamentals: Populating a Collection

Collections provide navigation and a way to handle a set of objects as a unit. When programming against an information model, you write code that materializes a collection so that you can access and otherwise manipulate its objects at run time.

The following example provides a simple illustration for adding objects to a collection. Suppose your information model contains a Schema object that has a collection of Tables attached to it. You can populate the Tables collection by writing code that adds specific instances (such as a Customer table and an Order table) to the collection.

You can populate the Tables collection with specific table instances using code like the following. Note that the relationships you can create are possible because the information model already contains definitions for collections.

Dim oSchema As RepositoryObject
Dim oCTable As RepositoryObject
Dim oISchema As ISchema
Set oSchema=oRepos.GetObject(ObjID_oSchema)
Set oTable=oRepos.GetObject(ObjID_oTable)
Set oISchema=oSchema
oISchema.Tables.Add(table)

See Also

Programming Fundamentals: Declaring Objects

Using Meta Data Services to Program Information Models