Borland EcoSubscription

The Borland.Eco.Subscription namespace contains interfaces and classes related to the ECO framework's subscription service. With subscriptions, you can tell the framework to send a notification when a particular event occurs within the object space. For example, you can have the framework send a notification when a certain object (or more likely, a collection of objects) within the ECO Space changes. The interfaces and classes provided in this namespace are:

  • ISubscriber. You must implement this interface on all classes that you want to act as subscribers.
  • SubscriberAdapterBase. This is an abstract base class you can use where you don't want to implement the ISubscriber interface directly.

Typically you will use the SubscriberAdapterBase class, overriding its DoReceive method, as shown in the following example:

uses

Borland.Eco.Subscription, Borland.Eco.Services;

type

TMySubscribingClass = class private type

TMySubscriberAdapter = class(SubscriberAdapterBase) strict protected procedure DoReceive(sender: System.Object; e: EventArgs); override; end; private

FmyAdapter: TMySubscribingClass.TMySubscriberAdapter; FextentService: IExtentService; procedure ExtentServiceChanged; procedure RespondToEvent; end;

procedure TMySubscribingClass.TMySubscriberAdapter.DoReceive(sender:

System.Object; e: EventArgs);

begin

// ActualSubscriber is a property of SubscriberAdapterBase. (ActualSubscriber as TMySubscribingClass).RespondToEvent; end;

procedure TMySubscribingClass.ExtentServiceChanged; begin

// Drop old subscriptions if any... if FmyAdapter <> nil then FmyAdapter.Deactivate();

FmyAdapter := TMySubscriberAdapter.Create(self); // Place a subscription FextentService.SubscribeToObjectAdded(FmyAdapter, nil); end;

procedure TMySubscribingClass.RespondToEvent; begin

// Add code to handle the event end;

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