Steve.Au
Steve.Au

Reputation: 31

Subscribing to Object value or associated change

Is there some doco on IAutoSubscriptionService. How do I use using (ESP.GetEcoService().StartSubscribe(subscriber)) to trigger an event when an object changes. That is for any attribute of an object.

Upvotes: 0

Views: 30

Answers (1)

Hans Karlsen
Hans Karlsen

Reputation: 2435

The StartSubscribe gives a IDisposable context back and it is typically used like this:

using (theAutoSubscriptionService.StartSubscribe(subscriber))
{
     arbitrary c# code accessing model elements 
     - all access will be added to subscription! 
     A thing of beauty really!
}

When something later change - the ISubscriber.Receive will fire. For adhoc usage consider the EventSubscriber class

Upvotes: 0

Related Questions