Choosing an Automation Server for a Class

Meta Data Services Programming

Meta Data Services Programming

Choosing an Automation Server for a Class

After you add your information model to a repository, you can run your tool. Periodically, your tool will invoke the CreateObject method to create an instance of one of the classes of your information model. CreateObject must create a run-time object (that is, an Automation object). To create the run-time object, the repository engine calls CoCreateInstance, using as a parameter the ClassID you provided as a property of the class.

When the engine calls CoCreateInstance with the ClassID, the system registry is checked to determine which Automation server contains the required class factory. For most classes in your information model, a generic Automation server for repository objects, Repodbc.dll, suffices. To use the generic server as the Automation server for a class, you can either do nothing, or you can specify Repodbc.dll in the entry for that class in the registry.

Although Repodbc.dll suffices as the Automation server for most repository classes, you will occasionally create a class whose instances require special treatment. For example:

  • A class of your information model requires input validation.

    You can validate the property values or collections of each instance of a class by writing a special Automation server for that class.

  • A class of your information model replicates some properties retained in another file format outside the repository.

    Suppose your information model includes a class whose instances describe Microsoft® Word documents. Each instance describes a Word document, indicating specifically its title, subject, and author. Your class-specific Automation server must include special code to ensure that the values of the repository properties match the values of title, subject, and author stored in the Word file.

  • A class of your information model requires some class-specific behavior that you implement in a method.

    Suppose your information model includes a class whose instances describe modem pools. Each instance describes a particular modem pool, including its phone number. Your class-specific Automation server can include a method to automatically dial the number and establish a connection.

    Note  At this time, the repository engine supports in-process Automation servers only (that is, dynamic-link libraries).

See Also

Creating Type Information Programmatically

Information Model Creation Issues