• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Rules.RuleValidation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Workflow.Activities.Rules.RuleValidation的典型用法代码示例。如果您正苦于以下问题:C# RuleValidation类的具体用法?C# RuleValidation怎么用?C# RuleValidation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RuleValidation类属于System.Workflow.Activities.Rules命名空间,在下文中一共展示了RuleValidation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Evaluate

		// Methods
		public override bool Evaluate (Activity activity, IServiceProvider provider)
		{

			Activity parent = activity;
			RuleDefinitions definitions = null;

			while (parent != null) {

				definitions = (RuleDefinitions) parent.GetValue (RuleDefinitions.RuleDefinitionsProperty);

				if (definitions != null)
					break;

				parent = parent.Parent;
			}

			if (definitions == null) {
				Console.WriteLine ("No definition");
				return false;
			}

			//Console.WriteLine ("Definition {0} at {1}", definitions, parent);
			RuleValidation validation = new RuleValidation (activity.GetType (), null);
			RuleExecution execution = new RuleExecution (validation, parent);
			RuleCondition condition = definitions.Conditions [ConditionName];
			//Console.WriteLine ("Condition {0}", condition);
			return condition.Evaluate (execution);
		}
开发者ID:alesliehughes,项目名称:olive,代码行数:29,代码来源:RuleConditionReference.cs


示例2: Execute

        protected override ActivityExecutionStatus Execute(ActivityExecutionContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            ExternalRuleSetService.ExternalRuleSetService ruleSetService = context.GetService<ExternalRuleSetService.ExternalRuleSetService>();

            if (ruleSetService != null)
            {
                RuleSet ruleSet = ruleSetService.GetRuleSet(new RuleSetInfo(this.RuleSetName, this.MajorVersion, this.MinorVersion));
                if (ruleSet != null)
                {
                    Activity targetActivity = this.GetRootWorkflow(this.Parent);
                    RuleValidation validation = new RuleValidation(targetActivity.GetType(), null);
                    RuleExecution execution = new RuleExecution(validation, targetActivity, context);
                    ruleSet.Execute(execution);
                }
            }
            else
            {
                throw new InvalidOperationException("A RuleSetService must be configured on the host to use the PolicyFromService activity.");
            }

            return ActivityExecutionStatus.Closed;
        }
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:27,代码来源:PolicyFromService.cs


示例3: Validate

 internal override RuleExpressionInfo Validate(CodeExpression expression, RuleValidation validation, bool isWritten)
 {
     RuleExpressionInfo info;
     bool flag;
     CodeDirectionExpression expression2 = (CodeDirectionExpression) expression;
     if (isWritten)
     {
         ValidationError item = new ValidationError(string.Format(CultureInfo.CurrentCulture, Messages.CannotWriteToExpression, new object[] { typeof(CodeDirectionExpression).ToString() }), 0x17a);
         item.UserData["ErrorObject"] = expression2;
         validation.Errors.Add(item);
         return null;
     }
     if (expression2.Expression == null)
     {
         ValidationError error2 = new ValidationError(Messages.NullDirectionTarget, 0x53d);
         error2.UserData["ErrorObject"] = expression2;
         validation.Errors.Add(error2);
         return null;
     }
     if (expression2.Expression is CodeTypeReferenceExpression)
     {
         ValidationError error = new ValidationError(string.Format(CultureInfo.CurrentCulture, Messages.CodeExpressionNotHandled, new object[] { expression2.Expression.GetType().FullName }), 0x548);
         error.UserData["ErrorObject"] = expression2.Expression;
         validation.AddError(error);
         return null;
     }
     if (expression2.Direction == FieldDirection.Ref)
     {
         flag = true;
         if (RuleExpressionWalker.Validate(validation, expression2.Expression, false) == null)
         {
             return null;
         }
         info = RuleExpressionWalker.Validate(validation, expression2.Expression, true);
     }
     else if (expression2.Direction == FieldDirection.Out)
     {
         flag = true;
         info = RuleExpressionWalker.Validate(validation, expression2.Expression, true);
     }
     else
     {
         flag = false;
         info = RuleExpressionWalker.Validate(validation, expression2.Expression, false);
     }
     if (info == null)
     {
         return null;
     }
     Type expressionType = info.ExpressionType;
     if (expressionType == null)
     {
         return null;
     }
     if (((expressionType != typeof(NullLiteral)) && flag) && !expressionType.IsByRef)
     {
         expressionType = expressionType.MakeByRefType();
     }
     return new RuleExpressionInfo(expressionType);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:60,代码来源:DirectionExpression.cs


示例4: Validate

 internal override bool Validate(RuleValidation validation, MemberInfo member, Type contextType, ParameterInfo[] parameters)
 {
     Stack<MemberInfo> methodStack = new Stack<MemberInfo>();
     methodStack.Push(member);
     bool flag = this.ValidateInvokeAttribute(validation, member, contextType, methodStack);
     methodStack.Pop();
     return flag;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:RuleInvokeAttribute.cs


示例5: Validate

 internal override bool Validate(RuleValidation validation)
 {
     bool flag = false;
     RuleExpressionInfo info = null;
     if (this.assignStatement.Left == null)
     {
         ValidationError item = new ValidationError(Messages.NullAssignLeft, 0x541);
         item.UserData["ErrorObject"] = this.assignStatement;
         validation.Errors.Add(item);
     }
     else
     {
         info = validation.ExpressionInfo(this.assignStatement.Left);
         if (info == null)
         {
             info = RuleExpressionWalker.Validate(validation, this.assignStatement.Left, true);
         }
     }
     RuleExpressionInfo info2 = null;
     if (this.assignStatement.Right == null)
     {
         ValidationError error2 = new ValidationError(Messages.NullAssignRight, 0x543);
         error2.UserData["ErrorObject"] = this.assignStatement;
         validation.Errors.Add(error2);
     }
     else
     {
         info2 = RuleExpressionWalker.Validate(validation, this.assignStatement.Right, false);
     }
     if ((info == null) || (info2 == null))
     {
         return flag;
     }
     Type expressionType = info2.ExpressionType;
     Type lhsType = info.ExpressionType;
     if (lhsType == typeof(NullLiteral))
     {
         ValidationError error3 = new ValidationError(Messages.NullAssignLeft, 0x542);
         error3.UserData["ErrorObject"] = this.assignStatement;
         validation.Errors.Add(error3);
         return false;
     }
     if (lhsType != expressionType)
     {
         ValidationError error = null;
         if (!RuleValidation.TypesAreAssignable(expressionType, lhsType, this.assignStatement.Right, out error))
         {
             if (error == null)
             {
                 error = new ValidationError(string.Format(CultureInfo.CurrentCulture, Messages.AssignNotAllowed, new object[] { RuleDecompiler.DecompileType(expressionType), RuleDecompiler.DecompileType(lhsType) }), 0x545);
             }
             error.UserData["ErrorObject"] = this.assignStatement;
             validation.Errors.Add(error);
             return flag;
         }
     }
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:58,代码来源:AssignmentStatement.cs


示例6: GetSideEffects

 public override ICollection<string> GetSideEffects(RuleValidation validation)
 {
     RuleAnalysis analysis = new RuleAnalysis(validation, true);
     if (this.codeDomStatement != null)
     {
         CodeDomStatementWalker.AnalyzeUsage(analysis, this.codeDomStatement);
     }
     return analysis.GetSymbols();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:RuleStatementAction.cs


示例7: GetDependencies

 public override ICollection<string> GetDependencies(RuleValidation validation)
 {
     RuleAnalysis analysis = new RuleAnalysis(validation, false);
     if (this._expression != null)
     {
         RuleExpressionWalker.AnalyzeUsage(analysis, this._expression, true, false, null);
     }
     return analysis.GetSymbols();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:RuleExpressionCondition.cs


示例8: ValidateInvokeAttribute

 private bool ValidateInvokeAttribute(RuleValidation validation, MemberInfo member, Type contextType, Stack<MemberInfo> methodStack)
 {
     ValidationError error;
     if (string.IsNullOrEmpty(this.methodInvoked))
     {
         error = new ValidationError(string.Format(CultureInfo.CurrentCulture, Messages.AttributeMethodNotFound, new object[] { member.Name, base.GetType().Name, Messages.NullValue }), 0x56b, true);
         error.UserData["ErrorObject"] = this;
         validation.AddError(error);
         return false;
     }
     bool flag = true;
     MemberInfo[] infoArray = contextType.GetMember(this.methodInvoked, MemberTypes.Property | MemberTypes.Method, BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
     if ((infoArray == null) || (infoArray.Length == 0))
     {
         error = new ValidationError(string.Format(CultureInfo.CurrentCulture, Messages.AttributeMethodNotFound, new object[] { member.Name, base.GetType().Name, this.methodInvoked }), 0x56b, true);
         error.UserData["ErrorObject"] = this;
         validation.AddError(error);
         return false;
     }
     for (int i = 0; i < infoArray.Length; i++)
     {
         MemberInfo item = infoArray[i];
         if (!methodStack.Contains(item))
         {
             methodStack.Push(item);
             object[] customAttributes = item.GetCustomAttributes(typeof(RuleAttribute), true);
             if ((customAttributes != null) && (customAttributes.Length != 0))
             {
                 foreach (RuleAttribute attribute in customAttributes)
                 {
                     RuleReadWriteAttribute attribute2 = attribute as RuleReadWriteAttribute;
                     if (attribute2 != null)
                     {
                         if (attribute2.Target == RuleAttributeTarget.Parameter)
                         {
                             error = new ValidationError(string.Format(CultureInfo.CurrentCulture, Messages.InvokeAttrRefersToParameterAttribute, new object[] { item.Name }), 0x1a5, true);
                             error.UserData["ErrorObject"] = this;
                             validation.AddError(error);
                             flag = false;
                         }
                         else
                         {
                             attribute2.Validate(validation, item, contextType, null);
                         }
                     }
                     else
                     {
                         ((RuleInvokeAttribute) attribute).ValidateInvokeAttribute(validation, item, contextType, methodStack);
                     }
                 }
             }
             methodStack.Pop();
         }
     }
     return flag;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:56,代码来源:RuleInvokeAttribute.cs


示例9: Validate

 internal override RuleExpressionInfo Validate(CodeExpression expression, RuleValidation validation, bool isWritten)
 {
     if (isWritten)
     {
         ValidationError item = new ValidationError(string.Format(CultureInfo.CurrentCulture, Messages.CannotWriteToExpression, new object[] { typeof(CodeThisReferenceExpression).ToString() }), 0x17a);
         item.UserData["ErrorObject"] = expression;
         validation.Errors.Add(item);
         return null;
     }
     return new RuleExpressionInfo(validation.ThisType);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:ThisExpression.cs


示例10: Validate

 internal override RuleExpressionInfo Validate(CodeExpression expression, RuleValidation validation, bool isWritten)
 {
     if (isWritten)
     {
         ValidationError item = new ValidationError(string.Format(CultureInfo.CurrentCulture, Messages.CannotWriteToExpression, new object[] { typeof(CodePrimitiveExpression).ToString() }), 0x17a);
         item.UserData["ErrorObject"] = expression;
         validation.Errors.Add(item);
         return null;
     }
     CodePrimitiveExpression expression2 = (CodePrimitiveExpression) expression;
     return new RuleExpressionInfo((expression2.Value != null) ? expression2.Value.GetType() : typeof(NullLiteral));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:PrimitiveExpression.cs


示例11: RuleConditionDialog

 public RuleConditionDialog(System.Type activityType, ITypeProvider typeProvider, CodeExpression expression)
 {
     this.ruleExpressionCondition = new RuleExpressionCondition();
     if (activityType == null)
     {
         throw new ArgumentNullException("activityType");
     }
     this.InitializeComponent();
     RuleValidation validation = new RuleValidation(activityType, typeProvider);
     this.ruleParser = new Parser(validation);
     this.InitializeDialog(expression);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:RuleConditionDialog.cs


示例12: Validate

        internal override RuleExpressionInfo Validate(CodeExpression expression, RuleValidation validation, bool isWritten)
        {
            if (isWritten)
            {
                string message = string.Format(CultureInfo.CurrentCulture, Messages.CannotWriteToExpression, typeof(CodeThisReferenceExpression).ToString());
                ValidationError error = new ValidationError(message, ErrorNumbers.Error_InvalidAssignTarget);
                error.UserData[RuleUserDataKeys.ErrorObject] = expression;
                validation.Errors.Add(error);
                return null;
            }

            return new RuleExpressionInfo(validation.ThisType);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:13,代码来源:Expressions.cs


示例13: RuleEngine

 internal RuleEngine(RuleSet ruleSet, RuleValidation validation, ActivityExecutionContext executionContext)
 {
     if (!ruleSet.Validate(validation))
     {
         throw new RuleSetValidationException(string.Format(CultureInfo.CurrentCulture, Messages.RuleSetValidationFailed, new object[] { ruleSet.name }), validation.Errors);
     }
     this.name = ruleSet.Name;
     this.validation = validation;
     Tracer tracer = null;
     if (WorkflowActivityTrace.Rules.Switch.ShouldTrace(TraceEventType.Information))
     {
         tracer = new Tracer(ruleSet.Name, executionContext);
     }
     this.analyzedRules = Executor.Preprocess(ruleSet.ChainingBehavior, ruleSet.Rules, validation, tracer);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:RuleEngine.cs


示例14: Validate

 public override bool Validate(RuleValidation validator)
 {
     if (validator == null)
     {
         throw new ArgumentNullException("validator");
     }
     if (this.codeDomStatement == null)
     {
         ValidationError error = new ValidationError(Messages.NullStatement, 0x53d);
         error.UserData["ErrorObject"] = this;
         validator.AddError(error);
         return false;
     }
     return CodeDomStatementWalker.Validate(validator, this.codeDomStatement);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:RuleStatementAction.cs


示例15: RuleExecution

 public RuleExecution(RuleValidation validation, object thisObject)
 {
     if (validation == null)
     {
         throw new ArgumentNullException("validation");
     }
     if (thisObject == null)
     {
         throw new ArgumentNullException("thisObject");
     }
     if (validation.ThisType != thisObject.GetType())
     {
         throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Messages.ValidationMismatch, new object[] { RuleDecompiler.DecompileType(validation.ThisType), RuleDecompiler.DecompileType(thisObject.GetType()) }));
     }
     this.validation = validation;
     this.activity = thisObject as System.Workflow.ComponentModel.Activity;
     this.thisObject = thisObject;
     this.thisLiteralResult = new RuleLiteralResult(thisObject);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:RuleExecution.cs


示例16: Validate

 internal override RuleExpressionInfo Validate(CodeExpression expression, RuleValidation validation, bool isWritten)
 {
     CodeTypeReferenceExpression expression2 = (CodeTypeReferenceExpression) expression;
     if (expression2.Type == null)
     {
         ValidationError item = new ValidationError(Messages.NullTypeType, 0x53d);
         item.UserData["ErrorObject"] = expression2;
         validation.Errors.Add(item);
         return null;
     }
     if (isWritten)
     {
         ValidationError error2 = new ValidationError(string.Format(CultureInfo.CurrentCulture, Messages.CannotWriteToExpression, new object[] { typeof(CodeTypeReferenceExpression).ToString() }), 0x17a);
         error2.UserData["ErrorObject"] = expression2;
         validation.Errors.Add(error2);
         return null;
     }
     return new RuleExpressionInfo(validation.ResolveType(expression2.Type));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:TypeReferenceExpression.cs


示例17: Evaluate

 public override bool Evaluate(Activity activity, IServiceProvider provider)
 {
     if (activity == null)
     {
         throw new ArgumentNullException("activity");
     }
     if (string.IsNullOrEmpty(this._condition))
     {
         throw new InvalidOperationException(SR.GetString("Error_MissingConditionName", new object[] { activity.Name }));
     }
     RuleDefinitions ruleDefinitions = null;
     if (string.IsNullOrEmpty(this.declaringActivityId))
     {
         CompositeActivity declaringActivity = null;
         ruleDefinitions = GetRuleDefinitions(activity, out declaringActivity);
     }
     else
     {
         ruleDefinitions = (RuleDefinitions) activity.GetActivityByName(this.declaringActivityId).GetValue(RuleDefinitions.RuleDefinitionsProperty);
     }
     if ((ruleDefinitions == null) || (ruleDefinitions.Conditions == null))
     {
         throw new InvalidOperationException(SR.GetString("Error_MissingRuleConditions"));
     }
     RuleCondition condition = ruleDefinitions.Conditions[this._condition];
     if (condition == null)
     {
         return true;
     }
     Activity enclosingActivity = Helpers.GetEnclosingActivity(activity);
     RuleValidation validation = new RuleValidation(enclosingActivity);
     if (!condition.Validate(validation))
     {
         throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Messages.ConditionValidationFailed, new object[] { this._condition }));
     }
     RuleExecution execution = new RuleExecution(validation, enclosingActivity, provider as ActivityExecutionContext);
     return condition.Evaluate(execution);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:38,代码来源:RuleConditionReference.cs


示例18: Validate

        internal override bool Validate(RuleValidation validation)
        {
            bool success = false;

            if (exprStatement.Expression == null)
            {
                ValidationError error = new ValidationError(Messages.NullInvokeStatementExpression, ErrorNumbers.Error_ParameterNotSet);
                error.UserData[RuleUserDataKeys.ErrorObject] = exprStatement;
                validation.Errors.Add(error);
            }
            else if (exprStatement.Expression is CodeMethodInvokeExpression)
            {
                RuleExpressionInfo exprInfo = RuleExpressionWalker.Validate(validation, exprStatement.Expression, false);
                success = (exprInfo != null);
            }
            else
            {
                ValidationError error = new ValidationError(Messages.InvokeNotHandled, ErrorNumbers.Error_CodeExpressionNotHandled);
                error.UserData[RuleUserDataKeys.ErrorObject] = exprStatement;
                validation.Errors.Add(error);
            }

            return success;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:24,代码来源:Statements.cs


示例19: Deserialize

        public static Rule Deserialize(this RuleContract contract)
        {
            Assembly ruleAssembly = typeof(Rule).Assembly;
            Type parserType = ruleAssembly.GetType("System.Workflow.Activities.Rules.Parser");

            RuleValidation validation = new RuleValidation(typeof(Person), null);
            var internalRuleParser = Activator.CreateInstance(parserType, BindingFlags.Instance | BindingFlags.NonPublic, null, new object[] { validation }, null);

            var parseConditionMethodInfo = parserType.GetMethod("ParseCondition", BindingFlags.Instance | BindingFlags.NonPublic);
            RuleExpressionCondition condition = parseConditionMethodInfo.Invoke(internalRuleParser, new object[] { contract.Condition }) as RuleExpressionCondition;

            Rule rule = new Rule {
                Name = contract.Name,
                Priority = contract.Priority,
                ReevaluationBehavior = (RuleReevaluationBehavior)Enum.Parse(typeof(RuleReevaluationBehavior), contract.Reevaluation),
                Active = contract.Active,
                Condition = condition,
            };

            var parseSingleStatementMethodInfo = parserType.GetMethod("ParseSingleStatement", BindingFlags.Instance | BindingFlags.NonPublic);

            foreach (string str in contract.ThenActions) {
                RuleAction action = parseSingleStatementMethodInfo.Invoke(internalRuleParser, new object[] { str }) as RuleAction;
                rule.ThenActions.Add(action);
            }

            var parseStatementListMethodInfo = parserType.GetMethod("ParseStatementList", BindingFlags.Instance | BindingFlags.NonPublic);
            IList<RuleAction> elseActions = parseStatementListMethodInfo.Invoke(internalRuleParser, new object[] { string.Join("\n", contract.ElseActions) }) as IList<RuleAction>;
            if (elseActions != null) {
                foreach (RuleAction action in elseActions) {
                    rule.ElseActions.Add(action);
                }
            }

            return rule;
        }
开发者ID:hva,项目名称:RuleSetDialog,代码行数:36,代码来源:Utils.cs


示例20: GetThisType

        private bool GetThisType(string rulesFileDirectoryPath, string rulesFileName)
        {
            bool successfulLoad = false;

            if (!string.IsNullOrEmpty(rulesFileDirectoryPath) && selectedRuleSetData != null)
            {
                string thisTypeAssemblyPath = rulesFileDirectoryPath + Path.DirectorySeparatorChar + "bin" + Path.DirectorySeparatorChar + "Debug";
                if (Directory.Exists(thisTypeAssemblyPath))
                {
                    assemblyPath = thisTypeAssemblyPath;
                    string[] fileNames = Directory.GetFiles(thisTypeAssemblyPath);
                    Dictionary<Type,string> candidateThisTypes = new Dictionary<Type,string>();

                    //try and automatically locate the Type referenced by this ruleset
                    foreach (string fileName in fileNames)
                    {
                        if (fileName.EndsWith("dll", StringComparison.Ordinal) || fileName.EndsWith("exe", StringComparison.Ordinal))
                        {
                            Assembly assembly = null;
                            try
                            {
                                assembly = Assembly.LoadFile(fileName); //this will skip the load if it's already been loaded, which is a problem if you point to a different assembly with the same version number
                            }
                            catch (Exception) //ignore this assembly then
                            {
                            }

                            if (assembly != null)
                            {
                                foreach (Type type in assembly.GetTypes())
                                {
                                    try
                                    {
                                        RuleValidation validation = new RuleValidation(type, null);
                                        if (selectedRuleSetData.RuleSet.Validate(validation))
                                            candidateThisTypes.Add(type,fileName); // type matches the ruleset members
                                    }
                                    catch (Exception) //error creating RuleValidation or doing validation so ignore this type
                                    {
                                    }
                                }
                            }
                        }
                    }

                    if (candidateThisTypes.Count == 0) //no matching types found so prompt the user
                    {
                        successfulLoad = this.PromptForThisType(rulesFileDirectoryPath);
                    }
                    else if (candidateThisTypes.Count == 1) //one matching Type in the assemblies in the default path, so just use it
                    {
                        IEnumerator enumerator = candidateThisTypes.Keys.GetEnumerator();
                        enumerator.MoveNext();
                        selectedRuleSetData.Activity = enumerator.Current as Type;
                        selectedRuleSetData.AssemblyPath = candidateThisTypes[selectedRuleSetData.Activity];
                        successfulLoad = true;
                    }
                    else //more than one matching Type
                    {
                        //see if there is a single Type with the same name as the .rules file
                        Dictionary<Type, string> candidateThisTypesMatchingName = new Dictionary<Type, string>();
                        foreach (Type type in candidateThisTypes.Keys)
                        {
                            if (type.Name == Path.GetFileNameWithoutExtension(rulesFileName))
                                candidateThisTypesMatchingName.Add(type, candidateThisTypes[type]);
                        }
                        if (candidateThisTypesMatchingName.Count == 1)
                        {
                            IEnumerator enumerator = candidateThisTypesMatchingName.Keys.GetEnumerator();
                            enumerator.MoveNext();
                            selectedRuleSetData.Activity = enumerator.Current as Type;
                            selectedRuleSetData.AssemblyPath = candidateThisTypesMatchingName[selectedRuleSetData.Activity];
                            successfulLoad = true;
                        }
                        else
                        {
                            successfulLoad = this.PromptForThisType(thisTypeAssemblyPath);
                        }
                    }
                }
                else
                {
                    successfulLoad = this.PromptForThisType(rulesFileDirectoryPath);
                }
            }
            return successfulLoad;
        }
开发者ID:egreene,项目名称:PracticeGDVP,代码行数:87,代码来源:RuleSetToolkitEditor.cs



注:本文中的System.Workflow.Activities.Rules.RuleValidation类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ComponentModel.Activity类代码示例发布时间:2022-05-26
下一篇:
C# Rules.Literal类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap