Accessing Automation Object Members
The repository API exposes a number of Automation objects that support multiple interfaces. For each Automation object, one interface is defined to be the default interface, and the members (the properties, methods, and collections) that are attached to that interface are accessible through the standard Microsoft® Visual Basic® mechanisms.
When accessing members that are attached to an interface that is not the default interface for an Automation object, a different access technique must be used. An additional reference to the object must be declared that explicitly calls for the nondefault interface. The nondefault interface members can then be accessed through the new object reference.
The following example illustrates how to access a property that is attached to an interface that is not the default interface for an Automation object. In this example, the connection string that is used to connect to the repository database is retrieved. Repository objects implement the IRepositoryODBC interface; this interface is not the default interface. The ConnectionString property is attached to the IRepositoryODBC interface. The ConnectionString property is the ODBC connection string that Microsoft SQL Server™ 2000 Meta Data Services uses when connecting to a database server.
Dim myRepos As Repository Dim nonDefIfc As IRepositoryODBC ' Initialize myRepos by opening a connection to a repository database. Set nonDefIfc = myRepos connect$ = nonDefIfc.ConnectionString
In this example, the nonDefIfc object does not use additional resources; rather, it is an alternate view of the myRepos object.