Ejemplo n.º 1
0
 // constructors
 /// <summary>
 /// Initializes a new instance of the BsonDocumentWriter class.
 /// </summary>
 /// <param name="topLevelDocument">The document to write to (normally starts out as an empty document).</param>
 /// <param name="settings">The settings.</param>
 public BsonDocumentWriter(BsonDocument topLevelDocument, BsonDocumentWriterSettings settings)
     : base(settings)
 {
     _topLevelDocument       = topLevelDocument;
     _documentWriterSettings = settings; // already frozen by base class
     _context = null;
     State    = BsonWriterState.Initial;
 }
Ejemplo n.º 2
0
 // constructors
 /// <summary>
 /// Initializes a new instance of the BsonDocumentWriter class.
 /// </summary>
 /// <param name="topLevelDocument">The document to write to (normally starts out as an empty document).</param>
 /// <param name="settings">The settings.</param>
 public BsonDocumentWriter(BsonDocument topLevelDocument, BsonDocumentWriterSettings settings)
     : base(settings)
 {
     _topLevelDocument = topLevelDocument;
     _documentWriterSettings = settings; // already frozen by base class
     _context = null;
     State = BsonWriterState.Initial;
 }
 // protected methods
 /// <summary>
 /// Creates a clone of the settings.
 /// </summary>
 /// <returns>A clone of the settings.</returns>
 protected override BsonWriterSettings CloneImplementation()
 {
     var clone = new BsonDocumentWriterSettings
     {
         GuidRepresentation = GuidRepresentation,
         MaxSerializationDepth = MaxSerializationDepth
     };
     return clone;
 }
Ejemplo n.º 4
0
        // protected methods
        /// <summary>
        /// Creates a clone of the settings.
        /// </summary>
        /// <returns>A clone of the settings.</returns>
        protected override BsonWriterSettings CloneImplementation()
        {
            var clone = new BsonDocumentWriterSettings
            {
                GuidRepresentation    = GuidRepresentation,
                MaxSerializationDepth = MaxSerializationDepth
            };

            return(clone);
        }
        // constructors
        /// <summary>
        /// Initializes a new instance of the BsonDocumentWriter class.
        /// </summary>
        /// <param name="topLevelDocument">The document to write to (normally starts out as an empty document).</param>
        /// <param name="settings">The settings.</param>
        public BsonDocumentWriter(BsonDocument topLevelDocument, BsonDocumentWriterSettings settings)
            : base(settings)
        {
            if (topLevelDocument == null)
            {
                throw new ArgumentNullException("topLevelDocument");
            }

            _topLevelDocument = topLevelDocument;
            _documentWriterSettings = settings; // already frozen by base class
            _context = null;
            State = BsonWriterState.Initial;
        }
Ejemplo n.º 6
0
        // constructors
        /// <summary>
        /// Initializes a new instance of the BsonDocumentWriter class.
        /// </summary>
        /// <param name="topLevelDocument">The document to write to (normally starts out as an empty document).</param>
        /// <param name="settings">The settings.</param>
        public BsonDocumentWriter(BsonDocument topLevelDocument, BsonDocumentWriterSettings settings)
            : base(settings)
        {
            if (topLevelDocument == null)
            {
                throw new ArgumentNullException("topLevelDocument");
            }

            _topLevelDocument       = topLevelDocument;
            _documentWriterSettings = settings; // already frozen by base class
            _context = null;
            State    = BsonWriterState.Initial;
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Creates a BsonWriter to a BsonDocument.
 /// </summary>
 /// <param name="document">A BsonDocument.</param>
 /// <param name="settings">The settings.</param>
 /// <returns>A BsonWriter.</returns>
 public static BsonWriter Create(BsonDocument document, BsonDocumentWriterSettings settings)
 {
     return(new BsonDocumentWriter(document, settings));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Creates a BsonWriter to a BsonDocument.
 /// </summary>
 /// <param name="document">A BsonDocument.</param>
 /// <param name="settings">The settings.</param>
 /// <returns>A BsonWriter.</returns>
 public static BsonWriter Create(BsonDocument document, BsonDocumentWriterSettings settings)
 {
     return new BsonDocumentWriter(document, settings);
 }