How to avoid ConfigurationService to add rules times

Topics: Developer Forum, User Forum
Feb 25, 2009 at 10:36 AM
When I use ConfigurationService.AddXmlFile in my application, how do I know whether this ConfigurationService has added this Xml, or where and how to use this method can avoid "An equivalent rule already exists in collection. RuleInterpretation :" Exception.

Feb 25, 2009 at 3:31 PM
I'm not sure I totally understand your question. Can you provide more details? Maybe an example?
Feb 26, 2009 at 12:57 AM
It's like this:

I want to use rules times to validate, there is my validate method:

        public string Validate(int taskId)
            //return value

            StringBuilder errorMessage = new StringBuilder();

            TaskInfo tI = GetTaskById(taskId);
            ValidationFramework.Configuration.ConfigurationService.AddXmlFile(System.Web.HttpContext.Current.Server.MapPath(".") + "\\validateXML\\val.validation.xml");

            PropertyValidationManager pVm = new PropertyValidationManager(tI);


            foreach (ValidationResult VR in pVm.ValidatorResultsInError)
            return errorMessage.ToString();

But when I call this method second time, the ConfigurationService is aready exist and the rules is aready exist too, so there will come an Exception say:


"An equivalent rule already exists in collection. RuleInterpretation :"
I want to know how to avoid this!