Class SubscriptionUtils
Inheritance
System.Object
SubscriptionUtils
Namespace: Eco.Core.Controller
Assembly: Eco.Core.dll
Syntax
public static class SubscriptionUtils : Object
Methods
SubscribeToListPropertyAndCall(ISubscriptions<ThreadSafeSubscriptions>, IController, String, String, Action)
Declaration
public static void SubscribeToListPropertyAndCall(this ISubscriptions<ThreadSafeSubscriptions> subs, IController parent, string listProperty, string entryProperty, Action onChanged)
Parameters
Type | Name | Description |
---|---|---|
ISubscriptions<ThreadSafeSubscriptions> | subs | |
IController | parent | |
System.String | listProperty | |
System.String | entryProperty | |
System.Action | onChanged |
UpdateSubject<T>(ref T, T, String, Action)
Updates subscription subject (action emitter). It is thread-safe and ensures old subscription removed from subject
even in concurrent environment.
It possible though that both newSubject
and subject
subscribed. it is very rare case, but you should aware of it.
It happens if action removed from old subject, but subject changed in another thread after this, before new subject assigned (it will be removed anyway because of interlocked change, but it may exists for short period of time).
Declaration
public static void UpdateSubject<T>(ref T subject, T newSubject, string propertyName, Action action)
where T : class, IController
Parameters
Type | Name | Description |
---|---|---|
T | subject | |
T | newSubject | |
System.String | propertyName | |
System.Action | action |
Type Parameters
Name | Description |
---|---|
T |