internal TaskManager(Func <ITaskRepository> repositoryFactory, TaskManagerOptions options = null) { options = options ?? TaskManagerOptions.Default; _lockManager = new LockManager(repositoryFactory, minTimeout: new TimeSpan(TimeSpan.TicksPerSecond)); _repositoryFactory = repositoryFactory; _clockProvider = _lockManager.ClockProvider; _listener = new TaskManagerListener(this, options.MainLoopWait, options.MaxWorkerThreads); using (var repository = repositoryFactory()) { _connectionString = repository.Database.Connection.ConnectionString; } }
/// <summary> /// Creates an ITaskManager instance. /// </summary> /// <param name="repositoryFactory">Delegate that creates an ITaskRepository instance.</param> /// <param name="options">(Optional)A task manager options object.</param> /// <returns>Returns an ITaskManager instance.</returns> public static ITaskManager Create(Func <ITaskRepository> repositoryFactory, TaskManagerOptions options = null) { return(new TaskManager(repositoryFactory, options)); }