SmartParts (or other classes) within that WorkItem can then raise the event or subscribe to the published event.
There are two ways of registering publications or subscriptions for an event:
- Using Attributes: You can use specific attributes as described in the example below to declare .NET events as event publications that will propagate via the event broker system. You then declare methods decorated with the EventSubscription attribute to receive these events in your classes. This is the simplest way of working with events, and provides the same flexibility as the normal programmatic approach—but requires less code. For the attributes to be processed, you must create or add the class instance to the WorkItem.
- Programatically: You write code to get an instance of the EventTopic you want to publish or subscribe to via the EventTopics collection of a WorkItem instance, and then call its methods to register and unregister publishers and subscribers. This gives flexibility in the placing of event registration and unregistration for publications and subscriptions, but is not required for most common cases. You can also fire topics programmatically in this way, without registering a publisher.
No comments:
Post a Comment