Example #1
0
        public InsertProperties(
            XElement element,
            InsertAttributes attributes,
            Extension <EvaluationContextResolver> context)
            : base(element)
        {
            Contract.Requires <ArgumentNullException>(element != null);
            Contract.Requires <ArgumentNullException>(attributes != null);
            Contract.Requires <ArgumentNullException>(context != null);

            this.attributes = attributes;
            this.context    = context;

            this.origin = new Lazy <XPathExpression>(() =>
                                                     !string.IsNullOrEmpty(attributes.Origin) ? context.Value.Context.CompileXPath(element, attributes.Origin) : null);

            this.at = new Lazy <XPathExpression>(() =>
                                                 !string.IsNullOrEmpty(attributes.At) ? context.Value.Context.CompileXPath(element, attributes.At) : null);

            this.position = new Lazy <InsertPosition>(() =>
                                                      !string.IsNullOrEmpty(attributes.Postition) ? (InsertPosition)Enum.Parse(typeof(InsertPosition), attributes.Postition, true) : InsertPosition.After);
        }
Example #2
0
        public InsertProperties(
            XElement element,
            InsertAttributes attributes,
            Extension<EvaluationContextResolver> context)
            : base(element)
        {
            Contract.Requires<ArgumentNullException>(element != null);
            Contract.Requires<ArgumentNullException>(attributes != null);
            Contract.Requires<ArgumentNullException>(context != null);

            this.attributes = attributes;
            this.context = context;

            this.origin = new Lazy<XPathExpression>(() =>
                !string.IsNullOrEmpty(attributes.Origin) ? context.Value.Context.CompileXPath(element, attributes.Origin) : null);

            this.at = new Lazy<XPathExpression>(() =>
                !string.IsNullOrEmpty(attributes.At) ? context.Value.Context.CompileXPath(element, attributes.At) : null);

            this.position = new Lazy<InsertPosition>(() =>
                !string.IsNullOrEmpty(attributes.Postition) ? (InsertPosition)Enum.Parse(typeof(InsertPosition), attributes.Postition, true) : InsertPosition.After);
        }