Пример #1
0
        private IEnumerable <ITransactionController> GetNewTransactionControllers(DeferredExecutor executor)
        {
            var result = new List <ITransactionController>();

            foreach (var task in executor)
            {
                var controller = task.GetTransactionControllerImplementation();

                var existingController = _transactionControllers.FirstOrDefault(
                    q => q.AreEquivalentSharedControllers(controller)
                    );
                if (existingController == null)
                {
                    existingController = result.FirstOrDefault(
                        q => q.AreEquivalentSharedControllers(controller)
                        );
                }

                if (existingController != null)
                {
                    task.SetSharedTransactionController(existingController);
                    continue;
                }

                task.SetSharedTransactionController(controller);
                result.Add(controller);
            }

            return(result);
        }
Пример #2
0
        public static DeferredExecutor ToExecutor(this IEnumerable <IDeferred> deferredTasks)
        {
            var executor = new DeferredExecutor();

            foreach (var task in deferredTasks)
            {
                executor.Add(task);
            }

            return(executor);
        }