Hangfire with parameterized constructor

I need to start job, which will start some processing.
I have class TaskSSN and the method Process in it. TaskSSN class have constructor with two parameters.

public class TaskSSN
    private string fileName;
    private string fileContent;
    public TaskSSN(string fileName, string fileContent)
        this.fileName = fileName;
        this.fileContent = fileContent;

    public void Process()
        //some actions...

Then I create object instanse and call Process method:

public void SomeMethod (LoadArg arg)
    TaskSSN task = new TaskSSN(arg.FileName, arg.FileContent);
    BackgroundJob.Enqueue(() => task.Process());

I understand that Hangfire uses default constructor and doesn’t have access to the object instance. In this issue Hangfire needs parameterless constructor it is said about dependency injection container and JobActivator. Sorry, but I’m new in dependency injection and don’t understand how to use DI and JobActivator in this case .
Can you tell me please (using my code, if it possible), how can I fix problem with parameterized constructor?

Thanks in advance.

If you can refactor your code and move the arguments into your Process method signature then you can avoid a parameterized constructor and pass arguments in like this:

BackgroundJob.Enqueue<TaskSSN>(t => t.Process(arg.FileName, arg.FileContent));

I don’t think dependency injection will help you in this situation unless your actual code is a lot different than the example you posted.

Move your configuration settings to a setting class.

public sealed class Configuration
    public string FileName { get; set; }
    public string FileContent { get; set; }

Modify your constructor to accept the Configuration object.

public TaskSSN(Configuration config)
    this.fileName = config.FileName;
    this.fileContent = config.FileContent;

Then, in your Startup class, configure your container. Here’s an example with Simple Injector pulling settings from an app.config.

var container = new Container();
container.RegisterSingleton(typeof(Email.Configuration), new Email.Configuration()
    FileName = ConfigurationManager.AppSettings["FileName"],
    FileContent = ConfigurationManager.AppSettings["FileContent"]
    .UseActivator(new SimpleInjectorJobActivator(container));