public JobRunner(IServiceScopeFactory scopeFactory) { this._scope = scopeFactory.CreateScope(); this._myAwesomeService = this._scope.ServiceProvider.GetService <IMyAwesomeService>(); }
private IMyAwesomeService MyService; // Create an instance of the Service public InstructorController(IMyAwesomeService myService) // Injection: Pass the service in to constructor. { MyService = myService; }