Пример #1
0
        public static IHasOperationDependency DependsOn(this IOperation operation, params string[] prerequisiteOperationIds)
        {
            Condition.Requires(operation).IsNotNull();

            //we can only have one dependency decoration per cake, so go grab that one and update it
            if (operation.HasDecoration <DependencyDecoration>())
            {
                var dec = operation.As <DependencyDecoration>();
                dec.Dependency.Prerequisites.AddRange(prerequisiteOperationIds);
                return(dec);
            }

            return(new DependencyDecoration(operation, prerequisiteOperationIds.ToList()));
        }
Пример #2
0
        public static IOperation DoesNotDependOn(this IOperation operation, params string[] prerequisiteOperationIds)
        {
            Condition.Requires(operation).IsNotNull();
            if (operation.HasDecoration <DependencyDecoration>())
            {
                var dec = operation.As <DependencyDecoration>();
                prerequisiteOperationIds.WithEach(pre =>
                {
                    dec.Dependency.Prerequisites.Remove(pre);
                });

                return(dec);
            }

            return(operation);
        }