Inheritance: System.IO.Stream
Example #1
0
        public XmlReader CreateReader()
        {
            if (IsNull)
            {
                throw new SqlNullValueException();
            }

            SqlXmlStreamWrapper stream = new SqlXmlStreamWrapper(m_stream);

            // if it is the first time we create reader and stream does not support CanSeek, no need to reset position
            if ((!firstCreateReader || stream.CanSeek) && stream.Position != 0)
            {
                stream.Seek(0, SeekOrigin.Begin);
            }

            // NOTE: Maintaining createSqlReaderMethodInfo private field member to preserve the serialization of the class
            if (createSqlReaderMethodInfo == null)
            {
                createSqlReaderMethodInfo = CreateSqlReaderMethodInfo;
            }
            Debug.Assert(createSqlReaderMethodInfo != null, "MethodInfo reference for XmlReader.CreateSqlReader should not be null.");

            XmlReader r = CreateSqlXmlReader(stream);

            firstCreateReader = false;
            return(r);
        }
Example #2
0
        public XmlReader CreateReader()
        {
            if (IsNull)
            {
                throw new SqlNullValueException();
            }

            SqlXmlStreamWrapper stream = new SqlXmlStreamWrapper(_stream);

            // if it is the first time we create reader and stream does not support CanSeek, no need to reset position
            if ((!_firstCreateReader || stream.CanSeek) && stream.Position != 0)
            {
                stream.Seek(0, SeekOrigin.Begin);
            }

            // NOTE: Maintaining createSqlReaderMethodInfo private field member to preserve the serialization of the class
            if (_createSqlReaderMethodInfo == null)
            {
                _createSqlReaderMethodInfo = CreateSqlReaderMethodInfo;
            }
            Debug.Assert(_createSqlReaderMethodInfo != null, "MethodInfo reference for XmlReader.CreateSqlReader should not be null.");

            XmlReader r = CreateSqlXmlReader(stream);
            _firstCreateReader = false;
            return r;
        }
        public XmlReader CreateReader()
        {
            if (this.IsNull)
            {
                throw new SqlNullValueException();
            }
            SqlXmlStreamWrapper wrapper = new SqlXmlStreamWrapper(this.m_stream);

            if ((!this.firstCreateReader || wrapper.CanSeek) && (wrapper.Position != 0L))
            {
                wrapper.Seek(0L, SeekOrigin.Begin);
            }
            XmlReader         reader   = null;
            XmlReaderSettings settings = new XmlReaderSettings {
                ConformanceLevel = ConformanceLevel.Fragment
            };

            if (this.createSqlReaderMethodInfo == null)
            {
                this.createSqlReaderMethodInfo = typeof(XmlReader).GetMethod("CreateSqlReader", BindingFlags.NonPublic | BindingFlags.Static);
            }
            reader = sqlReaderDelegate(wrapper, settings, null);
            this.firstCreateReader = false;
            return(reader);
        }
Example #4
0
        public XmlReader CreateReader()
        {
            if (IsNull)
            {
                throw new SqlNullValueException();
            }

            SqlXmlStreamWrapper stream = new SqlXmlStreamWrapper(_stream);

            // if it is the first time we create reader and stream does not support CanSeek, no need to reset position
            if ((!_firstCreateReader || stream.CanSeek) && stream.Position != 0)
            {
                stream.Seek(0, SeekOrigin.Begin);
            }


            XmlReader r = CreateSqlXmlReader(stream);
            _firstCreateReader = false;
            return r;
        }
Example #5
0
        public XmlReader CreateReader()
        {
            if (IsNull)
            {
                throw new SqlNullValueException();
            }

            SqlXmlStreamWrapper stream = new SqlXmlStreamWrapper(_stream);

            // if it is the first time we create reader and stream does not support CanSeek, no need to reset position
            if ((!_firstCreateReader || stream.CanSeek) && stream.Position != 0)
            {
                stream.Seek(0, SeekOrigin.Begin);
            }


            XmlReader r = CreateSqlXmlReader(stream);

            _firstCreateReader = false;
            return(r);
        }
 public XmlReader CreateReader()
 {
     if (this.IsNull)
     {
         throw new SqlNullValueException();
     }
     SqlXmlStreamWrapper wrapper = new SqlXmlStreamWrapper(this.m_stream);
     if ((!this.firstCreateReader || wrapper.CanSeek) && (wrapper.Position != 0L))
     {
         wrapper.Seek(0L, SeekOrigin.Begin);
     }
     XmlReader reader = null;
     XmlReaderSettings settings = new XmlReaderSettings {
         ConformanceLevel = ConformanceLevel.Fragment
     };
     if (this.createSqlReaderMethodInfo == null)
     {
         this.createSqlReaderMethodInfo = typeof(XmlReader).GetMethod("CreateSqlReader", BindingFlags.NonPublic | BindingFlags.Static);
     }
     reader = sqlReaderDelegate(wrapper, settings, null);
     this.firstCreateReader = false;
     return reader;
 }