protected override string?PropertyValidation(PropertyInfo pi)
        {
            if (pi.Name == nameof(ViewNameProps))
            {
                if (ViewNameProps.Count > 0 && !ViewName.HasText())
                {
                    return(ValidationMessage._0ShouldBeNull.NiceToString(pi.NiceName()));
                }

                if (ViewName.HasText() && Workflow != null)
                {
                    var dv = DynamicViewEntity.TryGetDynamicView(Workflow.MainEntityType.ToType(), ViewName);
                    if (dv != null)
                    {
                        return(ViewNamePropEmbedded.ValidateViewNameProps(dv, ViewNameProps));
                    }
                }
            }

            if (pi.Name == nameof(DecisionOptions))
            {
                return((pi, DecisionOptions).IsSetOnlyWhen(Type == WorkflowActivityType.Decision));
            }

            if (pi.Name == nameof(CustomNextButton) && CustomNextButton != null && Type != WorkflowActivityType.Task)
            {
                return(ValidationMessage._0IsSet.NiceToString(pi.NiceName()));
            }

            return(base.PropertyValidation(pi));
        }
        protected override string?PropertyValidation(PropertyInfo pi)
        {
            if (pi.Name == nameof(SubWorkflow))
            {
                var requiresSubWorkflow = this.Type == WorkflowActivityType.CallWorkflow || this.Type == WorkflowActivityType.DecompositionWorkflow;
                if (SubWorkflow != null && !requiresSubWorkflow)
                {
                    return(ValidationMessage._0ShouldBeNull.NiceToString(pi.NiceName()));
                }

                if (SubWorkflow == null && requiresSubWorkflow)
                {
                    return(ValidationMessage._0IsNotSet.NiceToString(pi.NiceName()));
                }
            }

            if (pi.Name == nameof(Script))
            {
                var requiresScript = this.Type == WorkflowActivityType.Script;
                if (Script != null && !requiresScript)
                {
                    return(ValidationMessage._0ShouldBeNull.NiceToString(pi.NiceName()));
                }

                if (Script == null && requiresScript)
                {
                    return(ValidationMessage._0IsNotSet.NiceToString(pi.NiceName()));
                }
            }

            if (pi.Name == nameof(ViewNameProps))
            {
                if (ViewNameProps.Count > 0 && !ViewName.HasText())
                {
                    return(ValidationMessage._0ShouldBeNull.NiceToString(pi.NiceName()));
                }

                if (ViewName.HasText())
                {
                    var dv = DynamicViewEntity.TryGetDynamicView(Lane.Pool.Workflow.MainEntityType.ToType(), ViewName);
                    if (dv != null)
                    {
                        return(ViewNamePropEmbedded.ValidateViewNameProps(dv, ViewNameProps));
                    }
                }
            }

            if (pi.Name == nameof(DecisionOptions))
            {
                return((pi, DecisionOptions).IsSetOnlyWhen(Type == WorkflowActivityType.Decision));
            }

            if (pi.Name == nameof(CustomNextButton) && CustomNextButton != null && Type != WorkflowActivityType.Task)
            {
                return(ValidationMessage._0IsSet.NiceToString(pi.NiceName()));
            }

            return(base.PropertyValidation(pi));
        }
示例#3
0
        protected override string?PropertyValidation(PropertyInfo pi)
        {
            if (pi.Name == nameof(ViewNameProps))
            {
                if (ViewNameProps.Count > 0 && !ViewName.HasText())
                {
                    return(ValidationMessage._0ShouldBeNull.NiceToString(pi.NiceName()));
                }

                if (ViewName.HasText() && Workflow != null)
                {
                    var dv = DynamicViewEntity.TryGetDynamicView(Workflow.MainEntityType.ToType(), ViewName);
                    if (dv != null)
                    {
                        return(ViewNamePropEmbedded.ValidateViewNameProps(dv, ViewNameProps));
                    }
                }
            }

            return(base.PropertyValidation(pi));
        }