/// <summary> /// Initializes a new instance of the <see cref="RequestMessageBase"/> class. /// </summary> /// <param name="bsonWriterSettings">The bson writer settings.</param> protected RequestMessageBase(BsonWriterSettings bsonWriterSettings) { if (bsonWriterSettings == null) { throw new ArgumentNullException("bsonWriterSettings"); } _bsonWriterSettings = bsonWriterSettings; }
/// <summary> /// Initializes a new instance of the <see cref="InsertMessage"/> class. /// </summary> public InsertMessage(BsonWriterSettings bsonWriterSettings) { if (bsonWriterSettings == null) { throw new ArgumentNullException("bsonWriterSettings"); } _bsonWriterSettings = bsonWriterSettings; Header = new MessageHeader(OpCode.Insert); }
protected string Serialize(Document document, BsonWriterSettings settings) { using (var mem = new MemoryStream()) { var writer = new BsonWriter(mem, settings); writer.WriteObject(document); writer.Flush(); return(Convert.ToBase64String(mem.ToArray())); } }
/// <summary> /// Initializes a new instance of the <see cref="QueryMessage"/> class. /// </summary> /// <param name="bsonWriterSettings">The bson writer settings.</param> /// <param name="query">The query.</param> /// <param name="fullCollectionName">Full name of the collection.</param> /// <param name="numberToReturn">The number to return.</param> /// <param name="numberToSkip">The number to skip.</param> /// <param name="returnFieldSelector">The return field selector.</param> public QueryMessage(BsonWriterSettings bsonWriterSettings, object query, String fullCollectionName, Int32 numberToReturn, Int32 numberToSkip, object returnFieldSelector) : base(bsonWriterSettings) { Header = new MessageHeader(OpCode.Query); Query = query; FullCollectionName = fullCollectionName; NumberToReturn = numberToReturn; NumberToSkip = numberToSkip; ReturnFieldSelector = returnFieldSelector; }
/// <summary> /// Initializes a new instance of the <see cref="DeleteMessage"/> class. /// </summary> /// <param name="bsonWriterSettings">The bson writer settings.</param> public DeleteMessage(BsonWriterSettings bsonWriterSettings) : base(bsonWriterSettings) { Header = new MessageHeader(OpCode.Delete); }
/// <summary> /// Initializes a new instance of the <see cref="QueryMessage"/> class. /// </summary> /// <param name="bsonWriterSettings">The bson writer settings.</param> /// <param name="query">The query.</param> /// <param name="fullCollectionName">Full name of the collection.</param> /// <param name="numberToReturn">The number to return.</param> /// <param name="numberToSkip">The number to skip.</param> public QueryMessage(BsonWriterSettings bsonWriterSettings, object query, String fullCollectionName, Int32 numberToReturn, Int32 numberToSkip) : this(bsonWriterSettings, query, fullCollectionName, numberToReturn, numberToSkip, null) { }
/// <summary> /// Initializes a new instance of the <see cref="QueryMessage"/> class. /// </summary> /// <param name="bsonWriterSettings">The bson writer settings.</param> /// <param name="query">The query.</param> /// <param name="fullCollectionName">Full name of the collection.</param> public QueryMessage(BsonWriterSettings bsonWriterSettings, object query, String fullCollectionName) : this(bsonWriterSettings, query, fullCollectionName, 0, 0) { }
/// <summary> /// Initializes a new instance of the <see cref="QueryMessage"/> class. /// </summary> /// <param name="bsonWriterSettings">The bson writer settings.</param> public QueryMessage(BsonWriterSettings bsonWriterSettings) : base(bsonWriterSettings) { Header = new MessageHeader(OpCode.Query); }