INFORMIX
DataBlade Developers Kit User's Guide
Chapter 6: Creating ActiveX Value Objects
Home Contents Index Master Index New Book

About ActiveX Value Objects

This section defines the terms value object, ActiveX value object, client project, and server project, and provides an overview of how to create ActiveX value objects.

Tip: For examples on how to create ActiveX value objects, see the DataBlade Developers Kit InfoShelf, described in "The DataBlade Developers Kit InfoShelf" of this manual's introduction.

ActiveX Value Objects

A value object is a client-side copy of database data, encapsulated with accessor methods.

An ActiveX value object is:

The following table summarizes the relationship between ActiveX elements and Informix opaque data type elements.
ActiveX Element Opaque Data Type Element

ActiveX control (sometimes referred to as an ActiveX object)

Opaque type/value object

Custom methods (dual interface)

Opaque type support routines

Properties

Accessor methods for the members of the data structure that defines the opaque type

States

N.A.

Events

N.A.

Interfaces (ActiveX value objects provide IRawObjectAccess and ITDkValue custom interfaces)

N.A.

Client and Server Projects

When you create an ActiveX value object, you are creating the following projects:

You can define multiple ActiveX value objects in a single client-and-server project pair. However, you cannot create a client project independently of a server project: each ActiveX value object defined in the client project must have a corresponding opaque type defined in the server project.

Important: Object persistence between server and client objects is not supported. In other words, although you can modify an ActiveX value object, an associated modification does not occur to the database data represented by that object unless you issue an SQL query.
BladeSmith can generate the client and server projects for you at the same time. The client project is generated in C++ and must be implemented in C++. However, you can choose to generate and implement the server project in C++ or C.

The following table describes the advantages and disadvantages of each language choice.
Server Project Language Advantages Disadvantages

C++

Much of the source code that compiles the client project can also be used to compile the server project.

C++ can be used only in opaque type support routines. If your project includes other DataBlade module objects, they must be implemented in C.

To define other DataBlade module objects, follow the instructions in Chapter 3, "Using BladeSmith."

C

If your project includes other DataBlade module objects, then all server code can be implemented in the same language (C). You do not need to concern yourself with the limitations and restrictions of using C++ in code that runs on the server.

The source code that compiles the client project cannot be shared with the server project. In addition to generating and implementing the client project in C++, you must generate and implement the server project in C.

Figure 6-1 illustrates the advantage of choosing C++ for both the client and server projects: much of the same generated source code can be used to compile each project.

Figure 6-1
Choosing C++ for Both Client and Server Projects

Creating ActiveX Value Objects Overview

This section provides an overview of how to create ActiveX value objects. This overview is intended to act as a map for information resources.

To create ActiveX value objects using the DataBlade Developers Kit, complete these general processes:

    1. Design the ActiveX value objects (see "Designing ActiveX Value Objects").

    1. Use BladeSmith to define the opaque types that you intend to encapsulate as ActiveX value objects (see "Defining the Underlying Opaque Types").

    1. Use BladeSmith to generate source code for the client and server projects (see "Generating Source Code for the Client and Server Projects").

    1. Use a text editor to implement the client and server projects by adding project-specific logic to the generated source code (see "Implementing ActiveX Value Objects").

    1. Use your software development environment to compile the client and server projects (see "Compiling Client and Server Projects").

    1. Use your software development environment to test and debug the client and server projects (see Chapter 8, "Testing and Debugging DataBlade Modules on UNIX" and Chapter 9, "Testing and Debugging DataBlade Modules on Windows NT").

    1. Use BladeSmith to regenerate source code for the client and server projects (see "Generating Source Code for the Client and Server Projects")

    1. Use BladePack to package your client and server projects for distribution (see "Creating an Installation Package").




DataBlade Developers Kit User's Guide, version 3.6
Copyright © 1998, Informix Software, Inc. All rights reserved.