Пример #1
0
        new public static Rule Load(XmlReader reader)
        {
            Rule rule = new Rule();

            rule.ReadXml(reader);

            return(rule);
        }
Пример #2
0
        public static Term Load(XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            Term evalExp = null;

            reader.MoveToStartElement();

            if (reader.IsRequiredStartElement(AuthorizationConstants.Elements.Rule))
            {
                Rule rule = new Rule();
                rule.ReadXml(reader);
                evalExp = rule;
            }

            if (reader.IsRequiredStartElement(AuthorizationConstants.Elements.LogicalAnd))
            {
                LogicalAndCollection logicalAnd = new LogicalAndCollection();
                logicalAnd.ReadXml(reader);
                evalExp = logicalAnd;
            }


            if (reader.IsRequiredStartElement(AuthorizationConstants.Elements.LogicalOr))
            {
                LogicalOrCollection logicalOr = new LogicalOrCollection();
                logicalOr.ReadXml(reader);
                evalExp = logicalOr;
            }

            if (evalExp != null)
            {
                return(evalExp);
            }
            else
            {
                throw new SerializationException("Invalid evaluation expression element.");
            }
        }