Ejemplo n.º 1
0
        /// <inheritdoc/>
        public override object DynamicInvoke(XPathContext xpathContext, params object[] param)
        {
            if (xpathContext == null)
            {
                throw new ArgumentNullException(nameof(xpathContext));
            }

            try {
                // fix params keyword
                // Delegate.DynamicInvoke ignores ParamArrayAttribute, should to convert to IEnumerable<T>
                // Plus, add Request document param and Namespecas from policy, required for functions like XPath
#if NETSTANDARD1_6
                MethodInfo method = this.del.GetMethodInfo();
#else
                MethodInfo method = this.del.Method;
#endif
                return(method.Invoke(null, this.prepareParams(new object[] { xpathContext }.Concat(param).ToArray()).ToArray()));
            }
            catch (TargetInvocationException ex) {
                throw new XacmlIndeterminateException("Error in function evaluation: ", ex);
            }
            catch (ArgumentException ex) {
                throw new XacmlInvalidDataTypeException("Wrong argument", ex);
            }
            catch (InvalidCastException ex) {
                throw new XacmlInvalidDataTypeException("Wrong data type", ex);
            }
        }
        /// <inheritdoc/>
        public override object DynamicInvoke(XPathContext xpathContext, params object[] param) {
            Contract.Requires<ArgumentNullException>(xpathContext != null);

            try {
                // fix params keyword
                // Delegate.DynamicInvoke ignores ParamArrayAttribute, should to convert to IEnumerable<T>
                // Plus, add Request document param and Namespecas from policy, required for functions like XPath
                return this.del.Method.Invoke(null, (this.prepareParams(new object[] { xpathContext }.Concat(param).ToArray()).ToArray()));
            }
            catch (TargetInvocationException ex) {
                throw new XacmlIndeterminateException("Error in function evaluation: ", ex);
            }
            catch (ArgumentException ex) {
                throw new XacmlInvalidDataTypeException("Wrong argument", ex);
            }
            catch (InvalidCastException ex) {
                throw new XacmlInvalidDataTypeException("Wrong data type", ex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Dynamics the invoke.
        /// </summary>
        /// <param name="xpathContext">The xpath context.</param>
        /// <param name="param">An array of objects that are the arguments to pass to the method represented by the current delegate.</param>
        /// <returns>The object returned by the method represented by the delegate.</returns>
        public virtual object DynamicInvoke(XPathContext xpathContext, params object[] param)
        {
            try {
                // fix params keyword
                // Delegate.DynamicInvoke ignores ParamArrayAttribute, should to convert to IEnumerable<T>
#if NETSTANDARD1_6
                MethodInfo method = this.del.GetMethodInfo();
#else
                MethodInfo method = this.del.Method;
#endif
                return(method.Invoke(null, this.prepareParams(param)));
            }
            catch (TargetInvocationException ex) {
                throw new XacmlIndeterminateException("Error in function evaluation: ", ex);
            }
            catch (ArgumentException ex) {
                throw new XacmlInvalidDataTypeException("Wrong argument", ex);
            }
            catch (InvalidCastException ex) {
                throw new XacmlInvalidDataTypeException("Wrong data type", ex);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Dynamics the invoke.
 /// </summary>
 /// <param name="xpathContext">The xpath context.</param>
 /// <param name="param">An array of objects that are the arguments to pass to the method represented by the current delegate.</param>
 /// <returns>The object returned by the method represented by the delegate.</returns>
 /// <exception cref="XacmlIndeterminateException">Error in function evaluation: </exception>
 /// <exception cref="XacmlInvalidDataTypeException">
 /// Wrong argument
 /// or
 /// Wrong data type
 /// </exception>
 public virtual object DynamicInvoke(XPathContext xpathContext, params object[] param) {
     try {
         // fix params keyword
         // Delegate.DynamicInvoke ignores ParamArrayAttribute, should to convert to IEnumerable<T>
         return this.del.Method.Invoke(null, this.prepareParams(param));
     }
     catch (TargetInvocationException ex) {
         throw new XacmlIndeterminateException("Error in function evaluation: ", ex);
     }
     catch (ArgumentException ex) {
         throw new XacmlInvalidDataTypeException("Wrong argument", ex);
     }
     catch (InvalidCastException ex) {
         throw new XacmlInvalidDataTypeException("Wrong data type", ex);
     }
 }