当前位置: 首页>>代码示例>>C#>>正文


C# IO.BsonBinaryReaderContext类代码示例

本文整理汇总了C#中MongoDB.Bson.IO.BsonBinaryReaderContext的典型用法代码示例。如果您正苦于以下问题:C# BsonBinaryReaderContext类的具体用法?C# BsonBinaryReaderContext怎么用?C# BsonBinaryReaderContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BsonBinaryReaderContext类属于MongoDB.Bson.IO命名空间,在下文中一共展示了BsonBinaryReaderContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BsonBinaryReaderContext

 // constructors
 internal BsonBinaryReaderContext(BsonBinaryReaderContext parentContext, ContextType contextType, int startPosition, int size)
 {
     this.parentContext = parentContext;
     this.contextType = contextType;
     this.startPosition = startPosition;
     this.size = size;
 }
开发者ID:kamaradclimber,项目名称:mongo-csharp-driver,代码行数:8,代码来源:BsonBinaryReaderContext.cs

示例2: BsonBinaryReaderBookmark

 // constructors
 internal BsonBinaryReaderBookmark(
     BsonReaderState state,
     BsonType currentBsonType,
     string currentName,
     BsonBinaryReaderContext context,
     int position)
     : base(state, currentBsonType, currentName)
 {
     _context = context.Clone();
     _position = position;
 }
开发者ID:abel,项目名称:sinan,代码行数:12,代码来源:BsonBinaryReaderBookmark.cs

示例3: BsonBinaryReaderContext

 // constructors
 internal BsonBinaryReaderContext(
     BsonBinaryReaderContext parentContext,
     ContextType contextType,
     int startPosition, 
     int size)
 {
     _parentContext = parentContext;
     _contextType = contextType;
     _startPosition = startPosition;
     _size = size;
 }
开发者ID:Khosrow-Azizi,项目名称:MasterExperimentV2,代码行数:12,代码来源:BsonBinaryReaderContext.cs

示例4: BsonBinaryReaderBookmark

 internal BsonBinaryReaderBookmark(
     BsonBinaryReaderContext context,
     BsonReadState state,
     BsonType currentBsonType,
     int position
 )
 {
     this.context = context;
     this.state = state;
     this.currentBsonType = currentBsonType;
     this.position = position;
 }
开发者ID:swiggin1,项目名称:mongo-csharp-driver,代码行数:12,代码来源:BsonBinaryReaderBookmark.cs

示例5: BsonBinaryReader

 /// <summary>
 /// Initializes a new instance of the BsonBinaryReader class.
 /// <param name="buffer">A BsonBuffer.</param>
 /// <param name="settings">A BsonBinaryReaderSettings.</param>
 /// </summary>
 public BsonBinaryReader(
     BsonBuffer buffer,
     BsonBinaryReaderSettings settings
 ) {
     if (buffer == null) {
         this.buffer = new BsonBuffer();
         this.disposeBuffer = true; // only call Dispose if we allocated the buffer
     } else {
         this.buffer = buffer;
         this.disposeBuffer = false;
     }
     this.settings = settings.Freeze();
     context = new BsonBinaryReaderContext(null, ContextType.TopLevel, 0, 0);
 }
开发者ID:ebix,项目名称:mongo-csharp-driver,代码行数:19,代码来源:BsonBinaryReader.cs

示例6: BsonBinaryReader

 // constructors
 /// <summary>
 /// Initializes a new instance of the BsonBinaryReader class.
 /// </summary>
 /// <param name="buffer">A BsonBuffer.</param>
 /// <param name="settings">A BsonBinaryReaderSettings.</param>
 public BsonBinaryReader(BsonBuffer buffer, BsonBinaryReaderSettings settings)
     : base(settings)
 {
     if (buffer == null)
     {
         _buffer = new BsonBuffer();
         _disposeBuffer = true; // only call Dispose if we allocated the buffer
     }
     else
     {
         _buffer = buffer;
         _disposeBuffer = false;
     }
     _binaryReaderSettings = settings; // already frozen by base class
     _context = new BsonBinaryReaderContext(null, ContextType.TopLevel, 0, 0);
 }
开发者ID:moonreplace,项目名称:mongo-csharp-driver,代码行数:22,代码来源:BsonBinaryReader.cs

示例7: BsonBinaryReader

        /// <summary>
        /// Initializes a new instance of the BsonBinaryReader class.
        /// </summary>
        /// <param name="stream">A stream (BsonBinary does not own the stream and will not Dispose it).</param>
        /// <param name="settings">A BsonBinaryReaderSettings.</param>
        public BsonBinaryReader(Stream stream, BsonBinaryReaderSettings settings)
            : base(settings)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            if (!stream.CanSeek)
            {
                throw new ArgumentException("The stream must be capable of seeking.", "stream");
            }

            _streamReader = new BsonStreamReader(stream, settings.Encoding);
            _settings = settings; // already frozen by base class

            _context = new BsonBinaryReaderContext(null, ContextType.TopLevel, 0, 0);
        }
开发者ID:Bogdan0x400,项目名称:mongo-csharp-driver,代码行数:22,代码来源:BsonBinaryReader.cs

示例8: GenerateDottedElementName

 private string GenerateDottedElementName(BsonBinaryReaderContext context, string elementName)
 {
     if (context.ContextType == ContextType.Document)
     {
         return GenerateDottedElementName(context.ParentContext, (context.CurrentElementName ?? "?") + "." + elementName);
     }
     else if (context.ContextType == ContextType.Array)
     {
         var indexElementName = context.CurrentArrayIndex.ToString(NumberFormatInfo.InvariantInfo);
         return GenerateDottedElementName(context.ParentContext, indexElementName + "." + elementName);
     }
     else if (context.ParentContext != null)
     {
         return GenerateDottedElementName(context.ParentContext, "?." + elementName);
     }
     else
     {
         return elementName;
     }
 }
开发者ID:mfidemraizer,项目名称:mongo-csharp-driver,代码行数:20,代码来源:BsonBinaryReader.cs

示例9: ReadStartArray

        public override void ReadStartArray() {
            if (disposed) { ThrowObjectDisposedException(); }
            if (state != BsonReadState.Value || currentBsonType != BsonType.Array) {
                string message = string.Format("ReadStartArray cannot be called when ReadState is: {0} and BsonType is: {1}", state, currentBsonType);
                throw new InvalidOperationException(message);
            }

            var startPosition = buffer.Position; // position of size field
            var size = ReadSize();
            context = new BsonBinaryReaderContext(context, ContextType.Array, startPosition, size);
            state = BsonReadState.Type;
        }
开发者ID:swiggin1,项目名称:mongo-csharp-driver,代码行数:12,代码来源:BsonBinaryReader.cs

示例10: ReadStartDocument

        public override void ReadStartDocument() {
            if (disposed) { ThrowObjectDisposedException(); }
            if (
                state != BsonReadState.Initial &&
                state != BsonReadState.Done &&
                state != BsonReadState.ScopeDocument &&
                (state != BsonReadState.Value || currentBsonType != BsonType.Document)
            ) {
                string message = string.Format("ReadStartDocument cannot be called when ReadState is: {0} and BsonType is: {1}", state, currentBsonType);
                throw new InvalidOperationException(message);
            }

            var contextType = (state == BsonReadState.ScopeDocument) ? ContextType.ScopeDocument : ContextType.Document;
            var startPosition = buffer.Position; // position of size field
            var size = ReadSize();
            context = new BsonBinaryReaderContext(context, contextType, startPosition, size);
            state = BsonReadState.Type;
        }
开发者ID:swiggin1,项目名称:mongo-csharp-driver,代码行数:18,代码来源:BsonBinaryReader.cs

示例11: ReadJavaScriptWithScope

        /// <summary>
        /// Reads a BSON JavaScript with scope from the reader (call ReadStartDocument next to read the scope).
        /// </summary>
        /// <returns>A string.</returns>
        public override string ReadJavaScriptWithScope()
        {
            if (Disposed) { ThrowObjectDisposedException(); }
            VerifyBsonType("ReadJavaScriptWithScope", BsonType.JavaScriptWithScope);

            var startPosition = _bsonStream.Position; // position of size field
            var size = ReadSize();
            _context = new BsonBinaryReaderContext(_context, ContextType.JavaScriptWithScope, startPosition, size);
            var code = _bsonStream.ReadString(_settings.Encoding);

            State = BsonReaderState.ScopeDocument;
            return code;
        }
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:17,代码来源:BsonBinaryReader.cs

示例12: ReadStartDocument

        /// <summary>
        /// Reads the start of a BSON document.
        /// </summary>
        public override void ReadStartDocument() {
            if (disposed) { ThrowObjectDisposedException(); }
            VerifyBsonType("ReadStartDocument", BsonType.Document);

            var contextType = (state == BsonReaderState.ScopeDocument) ? ContextType.ScopeDocument : ContextType.Document;
            var startPosition = buffer.Position; // position of size field
            var size = ReadSize();
            context = new BsonBinaryReaderContext(context, contextType, startPosition, size);
            state = BsonReaderState.Type;
        }
开发者ID:redforks,项目名称:mongo-csharp-driver,代码行数:13,代码来源:BsonBinaryReader.cs

示例13: ReadJavaScriptWithScope

        /// <summary>
        /// Reads a BSON JavaScript with scope from the reader (call ReadStartDocument next to read the scope).
        /// </summary>
        /// <returns>A string.</returns>
        public override string ReadJavaScriptWithScope() {
            if (disposed) { ThrowObjectDisposedException(); }
            VerifyBsonType("ReadJavaScriptWithScope", BsonType.JavaScriptWithScope);

            var startPosition = buffer.Position; // position of size field
            var size = ReadSize();
            context = new BsonBinaryReaderContext(context, ContextType.JavaScriptWithScope, startPosition, size);
            var code = buffer.ReadString();

            state = BsonReaderState.ScopeDocument;
            return code;
        }
开发者ID:redforks,项目名称:mongo-csharp-driver,代码行数:16,代码来源:BsonBinaryReader.cs

示例14: BsonBinaryReader

 public BsonBinaryReader(
     BsonBuffer buffer,
     BsonBinaryReaderSettings settings
 ) {
     this.buffer = buffer ?? new BsonBuffer();
     this.disposeBuffer = buffer == null; // only call Dispose if we allocated the buffer
     this.settings = settings;
     context = null;
 }
开发者ID:swiggin1,项目名称:mongo-csharp-driver,代码行数:9,代码来源:BsonBinaryReader.cs

示例15: BsonBinaryReader

 public BsonBinaryReader(
     BsonBuffer buffer,
     BsonBinaryReaderSettings settings
 ) {
     this.buffer = buffer ?? new BsonBuffer();
     this.disposeBuffer = buffer == null; // only call Dispose if we allocated the buffer
     this.settings = settings;
     context = null;
     state = BsonReadState.Initial;
     currentBsonType = BsonType.Document;
 }
开发者ID:kenegozi,项目名称:mongo-csharp-driver,代码行数:11,代码来源:BsonBinaryReader.cs


注:本文中的MongoDB.Bson.IO.BsonBinaryReaderContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。