Many of the existing triggers have quite some boilerplate code, and follow the same structure: they take a Value of some type T, and activate when some condition Predicate<T> is met.
We could make a base class that would greatly reduce the boilerplate that would only expose one public property Value and a protected method or property Condition (a Predicate<T>), and that would reduce keep the trigger implementations limited to the "meaty part". Of course this base class could be inherited by 3rd parties who would like to create their own triggers based on simple conditions.
In the current library, the triggers that would benefit from this base trigger would be:
CompareStateTrigger
EqualsStateTrigger
IsFalseStateTrigger
NotEqualStateTrigger
IsNullOrEmptyStateTrigger (WIP)
Many of the existing triggers have quite some boilerplate code, and follow the same structure: they take a Value of some type
T, and activate when some conditionPredicate<T>is met.We could make a base class that would greatly reduce the boilerplate that would only expose one public property Value and a protected method or property Condition (a
Predicate<T>), and that would reduce keep the trigger implementations limited to the "meaty part". Of course this base class could be inherited by 3rd parties who would like to create their own triggers based on simple conditions.In the current library, the triggers that would benefit from this base trigger would be:
CompareStateTriggerEqualsStateTriggerIsFalseStateTriggerNotEqualStateTriggerIsNullOrEmptyStateTrigger(WIP)