Hangfire serializes the expressions to save them in the database and
then uses Dependency Injection to resolve instances used in the
expressions.
To get around this we save the given instance of IIntervalAction in a
Dictionary with a id. The expression then calls InvokeAction with the id
on the IAutomatedActionSystem interface, which Hangfire will resolve
from our DI container
Hangfire serializes the expressions to save them in the database and then uses Dependency Injection to resolve instances used in the expressions. To get around this we save the given instance of IIntervalAction in a Dictionary with a id. The expression then calls InvokeAction with the id on the IAutomatedActionSystem interface, which Hangfire will resolve from our DI container