コード例 #1
0
 public override Property CreateProperty(string propertyName)
 {
     if (string.IsNullOrEmpty(propertyName))
     {
         throw new RulesValidationException(RulesStrings.EmptyPropertyName);
     }
     return(MessageProperty.Create(propertyName));
 }
コード例 #2
0
        private static Dictionary <string, KeyValuePair <string, Type> > InitializeProperties()
        {
            Dictionary <string, KeyValuePair <string, Type> > dictionary = new Dictionary <string, KeyValuePair <string, Type> >(3);

            MessageProperty.AddProperty("Message.From", typeof(ShortList <string>), dictionary);
            MessageProperty.AddProperty("Message.To", typeof(ShortList <string>), dictionary);
            MessageProperty.AddProperty("Message.DataClassifications", typeof(IEnumerable <DiscoveredDataClassification>), dictionary);
            return(dictionary);
        }
コード例 #3
0
        private Condition ParseFork(XmlReader reader, RulesCreationContext creationContext)
        {
            base.VerifyNotEmptyTag(reader);
            bool   flag      = false;
            string attribute = reader.GetAttribute("exception");

            if (attribute != null)
            {
                bool.TryParse(attribute, out flag);
            }
            ShortList <string> shortList = new ShortList <string>();
            ScopeType          scopeType = ScopeType.None;

            base.ReadNext(reader);
            for (;;)
            {
                if (base.IsTag(reader, "recipient"))
                {
                    string requiredAttribute = base.GetRequiredAttribute(reader, "address");
                    shortList.Add(requiredAttribute);
                    if (!reader.IsEmptyElement)
                    {
                        base.ReadNext(reader);
                        base.VerifyEndTag(reader, "recipient");
                    }
                    base.ReadNext(reader);
                }
                else if (base.IsTag(reader, "external"))
                {
                    scopeType = ScopeType.External;
                    if (!reader.IsEmptyElement)
                    {
                        base.ReadNext(reader);
                        base.VerifyEndTag(reader, "external");
                    }
                    base.ReadNext(reader);
                }
                else if (base.IsTag(reader, "internal"))
                {
                    scopeType = ScopeType.Internal;
                    if (!reader.IsEmptyElement)
                    {
                        base.ReadNext(reader);
                        base.VerifyEndTag(reader, "internal");
                    }
                    base.ReadNext(reader);
                }
                else if (base.IsTag(reader, "externalPartner"))
                {
                    scopeType = ScopeType.ExternalPartner;
                    if (!reader.IsEmptyElement)
                    {
                        base.ReadNext(reader);
                        base.VerifyEndTag(reader, "externalPartner");
                    }
                    base.ReadNext(reader);
                }
                else if (base.IsTag(reader, "externalNonPartner"))
                {
                    scopeType = ScopeType.ExternalNonPartner;
                    if (!reader.IsEmptyElement)
                    {
                        base.ReadNext(reader);
                        base.VerifyEndTag(reader, "externalNonPartner");
                    }
                    base.ReadNext(reader);
                }
                else
                {
                    if (reader.NodeType == XmlNodeType.EndElement && reader.Name.Equals("fork"))
                    {
                        break;
                    }
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        if (!reader.IsEmptyElement)
                        {
                            base.ReadNext(reader);
                            base.VerifyEndTag(reader, reader.Name);
                        }
                        base.ReadNext(reader);
                    }
                }
            }
            Condition result = new UnconditionalTruePredicate();

            if (shortList.Count > 0)
            {
                SentToPredicate sentToPredicate = new SentToPredicate(MessageProperty.Create("Message.To"), shortList, creationContext);
                result = (flag ? new NotCondition(sentToPredicate) : sentToPredicate);
            }
            else if (scopeType != ScopeType.None)
            {
                SentToScopePredicate sentToScopePredicate = new SentToScopePredicate(MessageProperty.Create("Message.To"), scopeType, creationContext);
                result = (flag ? new NotCondition(sentToScopePredicate) : sentToScopePredicate);
            }
            return(result);
        }