Cannot create an instance of an interface

Regarding to IoC container usage – you only need to install it (nuget package link is available in the repository read me file) and register it in the global.asax.cs file:

protected void Application_Start()
{
    // ... some initialization logic
    var container = /* I don't know how to initialize the SimpleInjector container */
    // Register types in the container, but NOT IN REQUEST SCOPE!

    JobActivator.Current = new SimpleInjectorJobActivator(container);
}

@devmondo, can you give an example of HangFire.SimpleInjector usage?

There is another issue with parameters - it is better to pass cars entity identifier, you can read more in the Are your methods ready to run in background? blog post to get some more details.

1 Like