Beispiel #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="conflictRule"></param>
 public void AddConflictRule(ConflictRuleElement conflictRule)
 {
     if (conflictRule == null)
     {
         throw new ArgumentNullException("conflictRule");
     }
     _conflictRules.Add(conflictRule);
 }
Beispiel #2
0
        private void ExtractSecretData(CustomAttributeCollection attributes)
        {
            if (attributes == null || attributes.Count == 0)
            {
                return;
            }

            foreach (CustomAttribute attribute in attributes)
            {
                if (attribute.Constructor.DeclaringType.FullName.Equals(_resourceAttribute))
                {
                    ResourceElement re = new ResourceElement();
                    _resources.Add(re);
                    re.Name       = Convert.ToString(attribute.ConstructorParameters[0]);
                    re.Operations = Convert.ToString(attribute.ConstructorParameters[1]);
                }
                else if (attribute.Constructor.DeclaringType.FullName.Equals(_conflictRuleAttribute))
                {
                    ConflictRuleElement cre = new ConflictRuleElement();
                    _conflictRules.Add(cre);
                    cre.Resource = Convert.ToString(attribute.ConstructorParameters[0]);
                    cre.Pattern  = Convert.ToString(attribute.ConstructorParameters[1]);
                    if (attribute.ConstructorParameters.Count > 2)
                    {
                        cre.Constraint = Convert.ToBoolean(attribute.ConstructorParameters[2]);
                    }
                    else
                    {
                        cre.Constraint = true;
                    }
                    if (attribute.ConstructorParameters.Count > 3)
                    {
                        cre.Message = Convert.ToString(attribute.ConstructorParameters[3]);
                    }
                }
            }
        }