Decouple dashboard from "backend" bits

The project I’m working on has Hangfire to do the job handing part and it works great. The UI though can’t access the database directly, all communication has to go via a webservice. I’ve implemented a custom MonitoringApi which calls a webservice which wraps the SQL server monitoring api.

I had hoped that the dashboard would just work but sadly this is not the case. When going to the processing, queued or recurring job page the dashboard still wants to use an IStorageConnection. It would be good if the dashboard would be decoupled from the backend.

Simular for the “write” part in the dashboard. Being able to use a custom commanddispatcher instead of the default command/batch" processor would allow me to add the extra layer.

` public class HttpStorage
: JobStorage
{

    public override IStorageConnection GetConnection()
    {
        return null;
    }

    public override IMonitoringApi GetMonitoringApi()
    {
        return new HttpMonitoringApi();
    }
}

public class HttpMonitoringApi
    : IMonitoringApi
{
    //ommited
}`
1 Like