// constructors
 /// <summary>
 /// Initializes a new instance of the BsonDocumentReader class.
 /// </summary>
 /// <param name="document">A BsonDocument.</param>
 /// <param name="settings">The reader settings.</param>
 public BsonDocumentReader(BsonDocument document, BsonDocumentReaderSettings settings)
     : base(settings)
 {
     _context                = new BsonDocumentReaderContext(null, ContextType.TopLevel, document);
     _currentValue           = document;
     _documentReaderSettings = settings; // already frozen by base class
 }
 // protected methods
 /// <summary>
 /// Creates a clone of the settings.
 /// </summary>
 /// <returns>A clone of the settings.</returns>
 protected override BsonReaderSettings CloneImplementation()
 {
     var clone = new BsonDocumentReaderSettings
     {
         GuidRepresentation = GuidRepresentation
     };
     return clone;
 }
Esempio n. 3
0
        // protected methods
        /// <summary>
        /// Creates a clone of the settings.
        /// </summary>
        /// <returns>A clone of the settings.</returns>
        protected override BsonReaderSettings CloneImplementation()
        {
            var clone = new BsonDocumentReaderSettings
            {
                GuidRepresentation = GuidRepresentation
            };

            return(clone);
        }
        // constructors
        /// <summary>
        /// Initializes a new instance of the BsonDocumentReader class.
        /// </summary>
        /// <param name="document">A BsonDocument.</param>
        /// <param name="settings">The reader settings.</param>
        public BsonDocumentReader(BsonDocument document, BsonDocumentReaderSettings settings)
            : base(settings)
        {
            if (document == null)
            {
                throw new ArgumentNullException("document");
            }

            _context                = new BsonDocumentReaderContext(null, ContextType.TopLevel, document);
            _currentValue           = document;
            _documentReaderSettings = settings; // already frozen by base class
        }
Esempio n. 5
0
 /// <summary>
 /// Creates a BsonReader for a BsonDocument.
 /// </summary>
 /// <param name="document">The BsonDocument.</param>
 /// <param name="settings">The settings.</param>
 /// <returns>A BsonReader.</returns>
 public static BsonReader Create(BsonDocument document, BsonDocumentReaderSettings settings)
 {
     return(new BsonDocumentReader(document, settings));
 }