Exemple #1
0
        public MultiDictionary(MultiOperation parent)
        {
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }

            if (parent.Operations == null)
            {
                throw new ArgumentNullException(nameof(parent) + '.' + nameof(parent.Operations));
            }

            if (parent.Operations.Count == 0)
            {
                throw new ArgumentException("A MultiOperation must be provided that containst at least one operation", nameof(parent) + '.' + nameof(parent.Operations));
            }

            this.operations = parent.Operations;
            this.first      = this.operations.FirstOrDefault().Value;
        }
Exemple #2
0
        public IOperation CreateOperation(string operationName, T correlationContext)
        {
            try
            {
                // allocate operations per
                Dictionary <Guid, IOperation> createdOperations = new Dictionary <Guid, IOperation>();

                foreach (KeyValuePair <Guid, IOperationProvider <T> > operationProvider in this.operationProviders)
                {
                    IOperation createdOperation = operationProvider.Value.CreateOperation(operationName, correlationContext);
                    createdOperations[operationProvider.Key] = createdOperation;
                }

                MultiOperation multiOperation = new MultiOperation(createdOperations);

                return(multiOperation);
            }
            catch (Exception ex)
                when(Filter("An unexpected exception occurred when creatign a multiOperation", ex))
                {
                    return(new NullOperation());
                }
        }