Borland EcoObject Representation

There are two ways to access the objects in your application's ECO Space. The most direct way is to simply access the class' properties and methods through the source code generated from your class diagrams. The Borland.Eco.objectRepresentation namespace provides a second, more generic way that does not involve direct use of the types defined in the generated source code.

Instead, access to the objects is accomplished through a set of interfaces that all ECO classes implement indirectly (i.e. they are implemented for you by the class diagramming and code generation tools). As the name objectRepresentation implies, these interfaces expose the model the way it is represented internally within the ECO Space. One reason for accessing objects through the

ObjectRepresentation interfaces is if you are creating user interface controls that are designed to work with objects in an arbitrary ECO Space.

The second, more common use of the ObjectRepresentation interfaces is when you work with ECO services such as persistence, Undo/Redo, object versioning, and OCL evaluation; these services are defined in the Borland.Eco.Services namespace, and are available through your application's ECO Space object. The Services APIs take the ObjectRepresentation interfaces as parameters, and return references to them, which you can then use to call methods on the interface, or to cast to a type defined in your model. The following diagram shows the interfaces defined in the ObjectRepresentation namespace.

The root interface, IElement, contains a property called ContentType that you can examine to determine how to cast the interface reference. IElement represents all runtime elements, including the objects themselves, their attributes, the associations between classes in your model, and primitive types such as strings and collections. The key to linking your model as it exists on the class diagrams with its representation within the ECO framework, is to think of a single class as a generic container of elements. These elements might be primitive types, or objects, or they might be collections themselves, which in turn contain more elements.

For example, suppose you had a Person class in your model. You can think of this class as a container for a set of properties, such as personName, home, and ownedBuildings. The property personName is a string (a primitive type), the property home is an object of another class (which has its own set of properties), and ownedBuildings is a collection of objects. The following diagram shows how the mapping is made from the source code declaration to the interfaces implemented by the object's representation within the ECO Space.

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook

Post a comment