Exemplo n.º 1
0
        } = 10;                                                  // mcbtodo: make a config option for this.

        public static bool ExceedsMaxOperationDepth(CMCUDResult opResult)
        {
            if (OperationDepth > OperationMaxDepth)
            {
                opResult.Errors.Add($"Create, Update or Delete operations have exceeded the max depth of {OperationMaxDepth}.");
                return(true);
            }
            return(false);
        }
        public override CMCUDResult Update(FeatureDependencyDto updatingObject)
        {
            var opResult = new CMCUDResult();

            opResult = UpsertChecks(opResult, updatingObject);
            if (opResult.Errors.Any())
            {
                return(opResult);
            }

            return(base.Update(updatingObject));
        }
        public override CMCUDResult Insert(FeatureDependencyDto insertingObject)
        {
            var opResult = new CMCUDResult();

            opResult = UpsertChecks(opResult, insertingObject);
            if (opResult.Errors.Any())
            {
                return(opResult);
            }

            return(base.Insert(insertingObject));
        }
        private CMCUDResult UpsertChecks(CMCUDResult opResult, FeatureDependencyDto dto)
        {
            foreach (var taskDataRow in dto.PathOptions)
            {
                if (string.IsNullOrWhiteSpace(taskDataRow.FeatureVarName) && !string.IsNullOrWhiteSpace(taskDataRow.FeatureVarSetTo))
                {
                    opResult.Errors.Add("Cannot set a feature var value to check for without specifying the feature var itself (within a feature dependency).");
                }
            }

            // Make sure the options are listed in order by re-assigning them in order.
            dto.PathOptions = dto.PathOptions.OrderBy(po => po.Order).ToList();
            return(opResult);
        }