public static EvaluationOperation Load(XmlReader reader) { EvaluationOperation evalOperation = new EvaluationOperation(); evalOperation.ReadXml(reader); return(evalOperation); }
public override void ReadXml(XmlReader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } reader.MoveToRequiredStartElement(AuthorizationConstants.Elements.Rule); string termId = reader.GetOptionalAttribute(AuthorizationConstants.Attributes.TermId); if (!string.IsNullOrEmpty(termId)) { this.TermId = new Uri(termId); } this.Issuer = reader.GetOptionalAttribute(AuthorizationConstants.Attributes.Issuer); string evaluates = reader.GetOptionalAttribute(AuthorizationConstants.Attributes.Evaluates); if (!string.IsNullOrEmpty(evaluates)) { this.Evaluates = XmlConvert.ToBoolean(evaluates); } while (reader.Read()) { if (reader.IsRequiredStartElement(AuthorizationConstants.Elements.Operation)) { this.Operation = EvaluationOperation.Load(reader); } if (reader.IsRequiredStartElement(AuthorizationConstants.Elements.Match)) { this.MatchExpression = Match.Load(reader); } if (reader.IsRequiredEndElement(AuthorizationConstants.Elements.Rule)) { return; //break; } } reader.Read(); }
/// <summary> /// Initializes a new instance of the <see cref="Rule"/> class. /// </summary> /// <param name="matchType">An expression to match claims for the operation.</param> /// <param name="operation">The operation that performs an evaluation.</param> /// <param name="evaluates">The truthful evaluation for the rule.</param> public Rule(Match matchType, EvaluationOperation operation, bool evaluates) { this.MatchExpression = matchType; this.Operation = operation; this.Evaluates = evaluates; }
/// <summary> /// Initializes a new instance of the <see cref="Rule"/> class. /// </summary> /// <param name="matchType">An expression to match claims for the operation.</param> /// <param name="operation">The operation that performs an evaluation.</param> public Rule(Match matchType, EvaluationOperation operation) : this(matchType, operation, true) { }
/// <summary> /// Initializes a new instance of the <see cref="Rule" /> class. /// </summary> /// <param name="matchType">An expression to match claims for the operation.</param> /// <param name="operation">The operation that performs an evaluation.</param> /// <param name="evaluates">The truthful evaluation for the rule.</param> public Rule(Match matchType, EvaluationOperation operation, bool evaluates) { MatchExpression = matchType; Operation = operation; Evaluates = evaluates; }