This is the executable command generated by the XmlILGenerator.
예제 #1
0
 /// <summary>
 /// This function is called on every recompilation to discard all previous results
 /// </summary>
 private void Reset()
 {
     _compilerResults = null;
     _outputSettings  = null;
     _qil             = null;
     _command         = null;
 }
        public void Load(MethodInfo executeMethod, byte[] queryData, Type[] earlyBoundTypes)
        {
            Reset();

            if (executeMethod == null)
            {
                throw new ArgumentNullException("executeMethod");
            }

            if (queryData == null)
            {
                throw new ArgumentNullException("queryData");
            }

            // earlyBoundTypes may be null

            if (!System.Xml.XmlConfiguration.XsltConfigSection.EnableMemberAccessForXslCompiledTransform)
            {
                // make sure we have permission to create the delegate if the type is not visible.
                // If the declaring type is null we cannot check for visibility.
                // NOTE: a DynamicMethod will always have a DeclaringType == null. DynamicMethods will do demand on their own if skipVisibility is true.
                if (executeMethod.DeclaringType != null && !executeMethod.DeclaringType.IsVisible)
                {
                    new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand();
                }
            }

            DynamicMethod dm      = executeMethod as DynamicMethod;
            Delegate      delExec = (dm != null) ? dm.CreateDelegate(typeof(ExecuteDelegate)) : Delegate.CreateDelegate(typeof(ExecuteDelegate), executeMethod);

            this.command        = new XmlILCommand((ExecuteDelegate)delExec, new XmlQueryStaticData(queryData, earlyBoundTypes));
            this.outputSettings = this.command.StaticData.DefaultWriterSettings;
        }
예제 #3
0
 /// <summary>
 /// This function is called on every recompilation to discard all previous results
 /// </summary>
 private void Reset()
 {
     _compilerErrorColl = null;
     _outputSettings = null;
     _qil = null;
     _command = null;
 }
예제 #4
0
        /// <summary>
        /// Constructor called by compiled stylesheet class constructors. Tries to deserialize a command from a specially named
        /// private static field, which contains either byte[] or XmlQueryStaticData instance.
        /// </summary>
        protected XslCompiledTransformBase()
        {
            Debug.Assert(!(this is XslCompiledTransform));
            FieldInfo fldData  = this.GetType().GetField(XmlQueryStaticData.DataFieldName, BindingFlags.Static | BindingFlags.NonPublic);
            FieldInfo fldTypes = this.GetType().GetField(XmlQueryStaticData.TypesFieldName, BindingFlags.Static | BindingFlags.NonPublic);

            // If private fields are not there, it is not a compiled stylesheet class
            if (fldData != null && fldTypes != null)
            {
                // Need MemberAccess reflection permission to access a private data field and create a delegate
                new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Assert();

                object value = fldData.GetValue(/*this:*/ null);
                byte[] data  = value as byte[];
                if (data != null)
                {
                    // Deserialize query static data and create the command
                    MethodInfo methExec = this.GetType().GetMethod("Execute", BindingFlags.Static | BindingFlags.NonPublic);
                    Delegate   delExec  = Delegate.CreateDelegate(typeof(ExecuteDelegate), methExec);
                    value = new XmlILCommand((ExecuteDelegate)delExec, new XmlQueryStaticData(data, (Type[])fldTypes.GetValue(/*this:*/ null)));

                    // Store the constructed command in the same field
                    System.Threading.Thread.MemoryBarrier();
                    fldData.SetValue(/*this:*/ null, value);
                }

                this.command = value as XmlILCommand;
            }
        }
 /// <summary>
 /// This function is called on every recompilation to discard all previous results
 /// </summary>
 private void Reset()
 {
     this.compilerResults = null;
     this.outputSettings  = null;
     this.qil             = null;
     this.command         = null;
 }
예제 #6
0
        /// <summary>
        /// Constructor called by compiled stylesheet class constructors. Tries to deserialize a command from a specially named
        /// private static field, which contains either byte[] or XmlQueryStaticData instance.
        /// </summary>
        protected XslCompiledTransformBase() {
            Debug.Assert(!(this is XslCompiledTransform));
            FieldInfo fldData  = this.GetType().GetField(XmlQueryStaticData.DataFieldName,  BindingFlags.Static | BindingFlags.NonPublic);
            FieldInfo fldTypes = this.GetType().GetField(XmlQueryStaticData.TypesFieldName, BindingFlags.Static | BindingFlags.NonPublic);

            // If private fields are not there, it is not a compiled stylesheet class
            if (fldData != null && fldTypes != null) {
                // Need MemberAccess reflection permission to access a private data field and create a delegate
                new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Assert();

                object value = fldData.GetValue(/*this:*/null);
                byte[] data = value as byte[];
                if (data != null) {
                    // Deserialize query static data and create the command
                    MethodInfo methExec = this.GetType().GetMethod("Execute", BindingFlags.Static | BindingFlags.NonPublic);
                    Delegate delExec = Delegate.CreateDelegate(typeof(ExecuteDelegate), methExec);
                    value = new XmlILCommand((ExecuteDelegate)delExec, new XmlQueryStaticData(data, (Type[])fldTypes.GetValue(/*this:*/null)));

                    // Store the constructed command in the same field
                    System.Threading.Thread.MemoryBarrier();
                    fldData.SetValue(/*this:*/null, value);
                }

                this.command = value as XmlILCommand;
            }
        }
예제 #7
0
 /// <summary>
 /// This function is called on every recompilation to discard all previous results
 /// </summary>
 private void Reset()
 {
     _compilerResults = null;
     _outputSettings = null;
     _qil = null;
     _command = null;
 }
예제 #8
0
 /// <summary>
 /// This function is called on every recompilation to discard all previous results
 /// </summary>
 private void Reset()
 {
     _compilerErrorColl = null;
     _outputSettings    = null;
     _qil     = null;
     _command = null;
 }
예제 #9
0
        /// <summary>
        /// This function is called on every recompilation to discard all previous results
        /// </summary>
        private void Reset()
        {
            _compilerErrorColl = null;
            _outputSettings    = null;
            _qil = null;
#if FEATURE_COMPILED_XSL
            _command = null;
#endif
        }
예제 #10
0
        private void CompileQilToMsil(XsltSettings settings)
        {
#if FEATURE_COMPILED_XSL
            _command        = new XmlILGenerator().Generate(_qil, /*typeBuilder:*/ null);
            _outputSettings = _command.StaticData.DefaultWriterSettings;
            _qil            = null;
#else
            throw new PlatformNotSupportedException(SR.Xslt_NotSupported);
#endif
        }
예제 #11
0
        public void Load(MethodInfo executeMethod, byte[] queryData, Type[] earlyBoundTypes)
        {
            this.Reset();
            if (executeMethod == null)
            {
                throw new ArgumentNullException("executeMethod");
            }
            if (queryData == null)
            {
                throw new ArgumentNullException("queryData");
            }
            DynamicMethod method    = executeMethod as DynamicMethod;
            Delegate      delegate2 = (method != null) ? method.CreateDelegate(typeof(ExecuteDelegate)) : Delegate.CreateDelegate(typeof(ExecuteDelegate), executeMethod);

            this.command        = new XmlILCommand((ExecuteDelegate)delegate2, new XmlQueryStaticData(queryData, earlyBoundTypes));
            this.outputSettings = this.command.StaticData.DefaultWriterSettings;
        }
예제 #12
0
        public void Load(MethodInfo executeMethod, byte[] queryData, Type[] earlyBoundTypes)
        {
            Reset();

            if (executeMethod == null)
            {
                throw new ArgumentNullException(nameof(executeMethod));
            }

            if (queryData == null)
            {
                throw new ArgumentNullException(nameof(queryData));
            }


            DynamicMethod dm      = executeMethod as DynamicMethod;
            Delegate      delExec = (dm != null) ? dm.CreateDelegate(typeof(ExecuteDelegate)) : executeMethod.CreateDelegate(typeof(ExecuteDelegate));

            _command        = new XmlILCommand((ExecuteDelegate)delExec, new XmlQueryStaticData(queryData, earlyBoundTypes));
            _outputSettings = _command.StaticData.DefaultWriterSettings;
        }
예제 #13
0
        public void Load(MethodInfo executeMethod, byte[] queryData, Type[] earlyBoundTypes)
        {
#if FEATURE_COMPILED_XSL
            Reset();

            if (executeMethod == null)
            {
                throw new ArgumentNullException(nameof(executeMethod));
            }

            if (queryData == null)
            {
                throw new ArgumentNullException(nameof(queryData));
            }


            DynamicMethod dm      = executeMethod as DynamicMethod;
            Delegate      delExec = (dm != null) ? dm.CreateDelegate(typeof(ExecuteDelegate)) : executeMethod.CreateDelegate(typeof(ExecuteDelegate));
            _command        = new XmlILCommand((ExecuteDelegate)delExec, new XmlQueryStaticData(queryData, earlyBoundTypes));
            _outputSettings = _command.StaticData.DefaultWriterSettings;
#else
            throw new PlatformNotSupportedException(SR.Xslt_NotSupported);
#endif
        }
 private void CompileQilToMsil(XsltSettings settings) {
     this.command = new XmlILGenerator().Generate(this.qil, /*typeBuilder:*/null);
     this.outputSettings = this.command.StaticData.DefaultWriterSettings;
     this.qil = null;
 }
예제 #15
0
 private void CompileQilToMsil(XsltSettings settings)
 {
     _command        = new XmlILGenerator().Generate(_qil, /*typeBuilder:*/ null);
     _outputSettings = _command.StaticData.DefaultWriterSettings;
     _qil            = null;
 }
 public void Load(MethodInfo executeMethod, byte[] queryData, Type[] earlyBoundTypes)
 {
     this.Reset();
     if (executeMethod == null)
     {
         throw new ArgumentNullException("executeMethod");
     }
     if (queryData == null)
     {
         throw new ArgumentNullException("queryData");
     }
     DynamicMethod method = executeMethod as DynamicMethod;
     Delegate delegate2 = (method != null) ? method.CreateDelegate(typeof(ExecuteDelegate)) : Delegate.CreateDelegate(typeof(ExecuteDelegate), executeMethod);
     this.command = new XmlILCommand((ExecuteDelegate) delegate2, new XmlQueryStaticData(queryData, earlyBoundTypes));
     this.outputSettings = this.command.StaticData.DefaultWriterSettings;
 }
예제 #17
0
 /// <summary>
 /// Constructor called by XslCompiledTransform constructor
 /// </summary>
 internal XslCompiledTransformBase(XmlILCommand command) {
     Debug.Assert(this is XslCompiledTransform);
     this.command = command;
 }
예제 #18
0
 /// <summary>
 /// Constructor called by XslCompiledTransform constructor
 /// </summary>
 internal XslCompiledTransformBase(XmlILCommand command)
 {
     Debug.Assert(this is XslCompiledTransform);
     this.command = command;
 }
예제 #19
0
        public void Load(MethodInfo executeMethod, byte[] queryData, Type[] earlyBoundTypes)
        {
            Reset();

            if (executeMethod == null)
                throw new ArgumentNullException(nameof(executeMethod));

            if (queryData == null)
                throw new ArgumentNullException(nameof(queryData));


            DynamicMethod dm = executeMethod as DynamicMethod;
            Delegate delExec = (dm != null) ? dm.CreateDelegate(typeof(ExecuteDelegate)) : executeMethod.CreateDelegate(typeof(ExecuteDelegate));
            _command = new XmlILCommand((ExecuteDelegate)delExec, new XmlQueryStaticData(queryData, earlyBoundTypes));
            _outputSettings = _command.StaticData.DefaultWriterSettings;
        }
 /// <summary>
 /// This function is called on every recompilation to discard all previous results
 /// </summary>
 private void Reset() {
     this.compilerResults = null;
     this.outputSettings  = null;
     this.qil             = null;
     this.command         = null;
 }
        public void Load(MethodInfo executeMethod, byte[] queryData, Type[] earlyBoundTypes) {
            Reset();

            if (executeMethod == null)
                throw new ArgumentNullException("executeMethod");

            if (queryData == null)
                throw new ArgumentNullException("queryData");

            // earlyBoundTypes may be null

            if (!System.Xml.XmlConfiguration.XsltConfigSection.EnableMemberAccessForXslCompiledTransform)
            {
                // make sure we have permission to create the delegate if the type is not visible.
                // If the declaring type is null we cannot check for visibility.
                // NOTE: a DynamicMethod will always have a DeclaringType == null. DynamicMethods will do demand on their own if skipVisibility is true. 
                if (executeMethod.DeclaringType != null && !executeMethod.DeclaringType.IsVisible)
                {
                    new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand();
                }
            }

            DynamicMethod dm = executeMethod as DynamicMethod;
            Delegate delExec = (dm != null) ? dm.CreateDelegate(typeof(ExecuteDelegate)) : Delegate.CreateDelegate(typeof(ExecuteDelegate), executeMethod);
            this.command = new XmlILCommand((ExecuteDelegate)delExec, new XmlQueryStaticData(queryData, earlyBoundTypes));
            this.outputSettings = this.command.StaticData.DefaultWriterSettings;
        }
예제 #22
0
 private void CompileQilToMsil(XsltSettings settings)
 {
     this.command        = new XmlILGenerator().Generate(this.qil, null);
     this.outputSettings = this.command.StaticData.DefaultWriterSettings;
     this.qil            = null;
 }