本文整理汇总了C#中MongoDB.Bson.IO.BsonBinaryWriterSettings类的典型用法代码示例。如果您正苦于以下问题:C# BsonBinaryWriterSettings类的具体用法?C# BsonBinaryWriterSettings怎么用?C# BsonBinaryWriterSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BsonBinaryWriterSettings类属于MongoDB.Bson.IO命名空间,在下文中一共展示了BsonBinaryWriterSettings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Create
public static BsonWriter Create(
Stream stream,
BsonBinaryWriterSettings settings
)
{
return new BsonBinaryWriter(stream, null, BsonBinaryWriterSettings.Defaults);
}
开发者ID:kenegozi,项目名称:mongo-csharp-driver,代码行数:7,代码来源:BsonWriter.cs
示例2: BulkDeleteOperationArgs
// constructors
public BulkDeleteOperationArgs(
string collectionName,
string databaseName,
int maxBatchCount,
int maxBatchLength,
int maxDocumentSize,
int maxWireDocumentSize,
bool isOrdered,
BsonBinaryReaderSettings readerSettings,
IEnumerable<DeleteRequest> requests,
WriteConcern writeConcern,
BsonBinaryWriterSettings writerSettings)
: base(
collectionName,
databaseName,
maxBatchCount,
maxBatchLength,
maxDocumentSize,
maxWireDocumentSize,
isOrdered,
readerSettings,
requests.Cast<WriteRequest>(),
writeConcern,
writerSettings)
{
}
开发者ID:ExM,项目名称:mongo-csharp-driver,代码行数:27,代码来源:BulkDeleteOperationArgs.cs
示例3: MongoInsertMessage
// constructors
internal MongoInsertMessage(BsonBinaryWriterSettings writerSettings, string collectionFullName, bool checkElementNames, InsertFlags flags)
: base(MessageOpcode.Insert, null, writerSettings)
{
this.collectionFullName = collectionFullName;
this.checkElementNames = checkElementNames;
this.flags = flags;
}
开发者ID:kamaradclimber,项目名称:mongo-csharp-driver,代码行数:8,代码来源:MongoInsertMessage.cs
示例4: MongoDeleteMessage
// constructors
internal MongoDeleteMessage(BsonBinaryWriterSettings writerSettings, string collectionFullName, RemoveFlags flags, IMongoQuery query)
: base(MessageOpcode.Delete, null, writerSettings)
{
_collectionFullName = collectionFullName;
_flags = flags;
_query = query;
}
开发者ID:moonreplace,项目名称:mongo-csharp-driver,代码行数:8,代码来源:MongoDeleteMessage.cs
示例5: BulkMixedWriteOperation
// constructors
public BulkMixedWriteOperation(
Action<InsertRequest> assignId,
bool checkElementNames,
string collectionName,
string databaseName,
int maxBatchCount,
int maxBatchLength,
int maxDocumentSize,
int maxWireDocumentSize,
bool isOrdered,
BsonBinaryReaderSettings readerSettings,
IEnumerable<WriteRequest> requests,
WriteConcern writeConcern,
BsonBinaryWriterSettings writerSettings)
{
_assignId = assignId;
_checkElementNames = checkElementNames;
_collectionName = collectionName;
_databaseName = databaseName;
_maxBatchCount = maxBatchCount;
_maxBatchLength = maxBatchLength;
_maxDocumentSize = maxDocumentSize;
_maxWireDocumentSize = maxWireDocumentSize;
_isOrdered = isOrdered;
_readerSettings = readerSettings;
_requests = requests;
_writeConcern = writeConcern;
_writerSettings = writerSettings;
}
开发者ID:niemyjski,项目名称:mongo-csharp-driver,代码行数:30,代码来源:BulkMixedWriteOperation.cs
示例6: BulkWriteOperationArgs
// constructors
protected BulkWriteOperationArgs(
string collectionName,
string databaseName,
int maxBatchCount,
int maxBatchLength,
int maxDocumentSize,
int maxWireDocumentSize,
bool isOrdered,
BsonBinaryReaderSettings readerSettings,
IEnumerable<WriteRequest> requests,
WriteConcern writeConcern,
BsonBinaryWriterSettings writerSettings)
{
_collectionName = collectionName;
_databaseName = databaseName;
_maxBatchCount = maxBatchCount;
_maxBatchLength = maxBatchLength;
_maxDocumentSize = maxDocumentSize;
_maxWireDocumentSize = maxWireDocumentSize;
_isOrdered = isOrdered;
_readerSettings = readerSettings;
_requests = requests;
_writeConcern = writeConcern;
_writerSettings = writerSettings;
}
开发者ID:niemyjski,项目名称:mongo-csharp-driver,代码行数:26,代码来源:BulkWriteOperationArgs.cs
示例7: MongoInsertMessage
internal MongoInsertMessage(
BsonBinaryWriterSettings writerSettings,
string collectionFullName
)
: base(MessageOpcode.Insert, null, writerSettings) {
this.collectionFullName = collectionFullName;
}
开发者ID:emiaj,项目名称:mongo-csharp-driver,代码行数:7,代码来源:MongoInsertMessage.cs
示例8: BulkInsertOperationArgs
// constructors
public BulkInsertOperationArgs(
Action<InsertRequest> assignId,
bool checkElementNames,
string collectionName,
string databaseName,
int maxBatchCount,
int maxBatchLength,
int maxDocumentSize,
int maxWireDocumentSize,
bool isOrdered,
BsonBinaryReaderSettings readerSettings,
IEnumerable<InsertRequest> requests,
WriteConcern writeConcern,
BsonBinaryWriterSettings writerSettings)
: base(
collectionName,
databaseName,
maxBatchCount,
maxBatchLength,
maxDocumentSize,
maxWireDocumentSize,
isOrdered,
readerSettings,
requests.Cast<WriteRequest>(),
writeConcern,
writerSettings)
{
_assignId = assignId;
_checkElementNames = checkElementNames;
}
开发者ID:nsavga,项目名称:mongo-csharp-driver,代码行数:31,代码来源:BulkInsertOperationArgs.cs
示例9: MongoRequestMessage
private int _messageStartPosition = -1; // start position in buffer for backpatching messageLength
// constructors
protected MongoRequestMessage(
MessageOpcode opcode,
BsonBinaryWriterSettings writerSettings)
: base(opcode)
{
_writerSettings = writerSettings;
RequestId = Interlocked.Increment(ref __lastRequestId);
}
开发者ID:einaregilsson,项目名称:mongo-csharp-driver,代码行数:11,代码来源:MongoRequestMessage.cs
示例10: ReadOperationBase
protected ReadOperationBase(
string databaseName,
string collectionName,
BsonBinaryReaderSettings readerSettings,
BsonBinaryWriterSettings writerSettings)
: base(databaseName, collectionName, readerSettings, writerSettings)
{
}
开发者ID:GGsus,项目名称:mongo-csharp-driver,代码行数:8,代码来源:ReadOperationBase.cs
示例11: MongoUpdateMessage
// constructors
internal MongoUpdateMessage(BsonBinaryWriterSettings writerSettings, string collectionFullName, bool checkUpdateDocument, UpdateFlags flags, IMongoQuery query, IMongoUpdate update)
: base(MessageOpcode.Update, null, writerSettings)
{
this.collectionFullName = collectionFullName;
this.checkUpdateDocument = checkUpdateDocument;
this.flags = flags;
this.query = query;
this.update = update;
}
开发者ID:kamaradclimber,项目名称:mongo-csharp-driver,代码行数:10,代码来源:MongoUpdateMessage.cs
示例12: WriteOpcodeOperationBase
protected WriteOpcodeOperationBase(
string databaseName,
string collectionName,
BsonBinaryReaderSettings readerSettings,
BsonBinaryWriterSettings writerSettings,
WriteConcern writeConcern)
: base(databaseName, collectionName, readerSettings, writerSettings)
{
_writeConcern = writeConcern;
}
开发者ID:Nakro,项目名称:mongo-csharp-driver,代码行数:10,代码来源:WriteOpcodeOperationBase.cs
示例13: MongoQueryMessage
internal MongoQueryMessage(BsonBuffer buffer, BsonBinaryWriterSettings writerSettings, string collectionFullName, QueryFlags flags, int numberToSkip, int numberToReturn, IMongoQuery query, IMongoFields fields)
: base(MessageOpcode.Query, buffer, writerSettings)
{
this.collectionFullName = collectionFullName;
this.flags = flags;
this.numberToSkip = numberToSkip;
this.numberToReturn = numberToReturn;
this.query = query;
this.fields = fields;
}
开发者ID:kamaradclimber,项目名称:mongo-csharp-driver,代码行数:10,代码来源:MongoQueryMessage.cs
示例14: MongoQueryMessage
// constructors
internal MongoQueryMessage(
BsonBinaryWriterSettings writerSettings,
string collectionFullName,
QueryFlags flags,
int numberToSkip,
int numberToReturn,
IMongoQuery query,
IMongoFields fields)
: this(null, writerSettings, collectionFullName, flags, numberToSkip, numberToReturn, query, fields)
{
}
开发者ID:CloudMetal,项目名称:mongo-csharp-driver,代码行数:12,代码来源:MongoQueryMessage.cs
示例15: DatabaseOperation
protected DatabaseOperation(
string databaseName,
string collectionName,
BsonBinaryReaderSettings readerSettings,
BsonBinaryWriterSettings writerSettings)
{
_databaseName = databaseName;
_collectionName = collectionName;
_readerSettings = (BsonBinaryReaderSettings)readerSettings.FrozenCopy();
_writerSettings = (BsonBinaryWriterSettings)writerSettings.FrozenCopy();
}
开发者ID:jlyonsmith,项目名称:mongo-csharp-driver,代码行数:11,代码来源:DatabaseOperation.cs
示例16: SendMessageWithWriteConcern
protected WriteConcernResult SendMessageWithWriteConcern(
MongoConnection connection,
BsonBuffer buffer,
int requestId,
BsonBinaryReaderSettings readerSettings,
BsonBinaryWriterSettings writerSettings,
WriteConcern writeConcern)
{
CommandDocument getLastErrorCommand = null;
if (writeConcern.Enabled)
{
var fsync = (writeConcern.FSync == null) ? null : (BsonValue)writeConcern.FSync;
var journal = (writeConcern.Journal == null) ? null : (BsonValue)writeConcern.Journal;
var w = (writeConcern.W == null) ? null : writeConcern.W.ToGetLastErrorWValue();
var wTimeout = (writeConcern.WTimeout == null) ? null : (BsonValue)(int)writeConcern.WTimeout.Value.TotalMilliseconds;
getLastErrorCommand = new CommandDocument
{
{ "getlasterror", 1 }, // use all lowercase for backward compatibility
{ "fsync", fsync, fsync != null },
{ "j", journal, journal != null },
{ "w", w, w != null },
{ "wtimeout", wTimeout, wTimeout != null }
};
// piggy back on network transmission for message
var getLastErrorMessage = new MongoQueryMessage(writerSettings, DatabaseName + ".$cmd", QueryFlags.None, 0, 1, getLastErrorCommand, null);
getLastErrorMessage.WriteToBuffer(buffer);
}
connection.SendMessage(buffer, requestId);
WriteConcernResult writeConcernResult = null;
if (writeConcern.Enabled)
{
var writeConcernResultSerializer = BsonSerializer.LookupSerializer(typeof(WriteConcernResult));
var replyMessage = connection.ReceiveMessage<WriteConcernResult>(readerSettings, writeConcernResultSerializer, null);
if (replyMessage.NumberReturned == 0)
{
throw new MongoCommandException("Command 'getLastError' failed. No response returned");
}
writeConcernResult = replyMessage.Documents[0];
writeConcernResult.Command = getLastErrorCommand;
var mappedException = ExceptionMapper.Map(writeConcernResult);
if (mappedException != null)
{
throw mappedException;
}
}
return writeConcernResult;
}
开发者ID:neo2018,项目名称:mongo-csharp-driver,代码行数:53,代码来源:WriteOperation.cs
示例17: RemoveOperation
public RemoveOperation(
string databaseName,
string collectionName,
BsonBinaryReaderSettings readerSettings,
BsonBinaryWriterSettings writerSettings,
WriteConcern writeConcern,
IMongoQuery query,
RemoveFlags flags)
: base(databaseName, collectionName, readerSettings, writerSettings, writeConcern)
{
_query = query;
_flags = flags;
}
开发者ID:einaregilsson,项目名称:mongo-csharp-driver,代码行数:13,代码来源:RemoveOperation.cs
示例18: CreateBinaryWriter
public BsonBinaryWriter CreateBinaryWriter()
{
var writerSettings = new BsonBinaryWriterSettings();
if (_encoderSettings != null)
{
writerSettings.Encoding = _encoderSettings.GetOrDefault(MessageEncoderSettingsName.WriteEncoding, writerSettings.Encoding);
writerSettings.FixOldBinarySubTypeOnOutput = _encoderSettings.GetOrDefault(MessageEncoderSettingsName.FixOldBinarySubTypeOnOutput, writerSettings.FixOldBinarySubTypeOnOutput);
writerSettings.GuidRepresentation = _encoderSettings.GetOrDefault(MessageEncoderSettingsName.GuidRepresentation, writerSettings.GuidRepresentation);
writerSettings.MaxDocumentSize = _encoderSettings.GetOrDefault(MessageEncoderSettingsName.MaxDocumentSize, writerSettings.MaxDocumentSize);
writerSettings.MaxSerializationDepth = _encoderSettings.GetOrDefault(MessageEncoderSettingsName.MaxSerializationDepth, writerSettings.MaxSerializationDepth);
}
return new BsonBinaryWriter(_stream, writerSettings);
}
开发者ID:bollinim,项目名称:mongo-csharp-driver,代码行数:13,代码来源:MessageBinaryEncoderBase.cs
示例19: BsonBinaryWriter
/// <summary>
/// Initializes a new instance of the BsonBinaryWriter class.
/// </summary>
/// <param name="buffer">A BsonBuffer.</param>
/// <param name="disposeBuffer">if set to <c>true</c> this BsonBinaryReader will own the buffer and when Dispose is called the buffer will be Disposed also.</param>
/// <param name="settings">Optional BsonBinaryWriter settings.</param>
/// <exception cref="System.ArgumentNullException">
/// encoder
/// or
/// settings
/// </exception>
public BsonBinaryWriter(BsonBuffer buffer, bool disposeBuffer, BsonBinaryWriterSettings settings)
: base(settings)
{
if (buffer == null)
{
throw new ArgumentNullException("encoder");
}
_buffer = buffer;
_disposeBuffer = disposeBuffer;
_binaryWriterSettings = settings; // already frozen by base class
_context = null;
State = BsonWriterState.Initial;
}
开发者ID:kblok,项目名称:mongo-csharp-driver,代码行数:26,代码来源:BsonBinaryWriter.cs
示例20: DeserializeBatch_should_return_expected_result_when_GuidRepresentation_is_Standard
public void DeserializeBatch_should_return_expected_result_when_GuidRepresentation_is_Standard()
{
var document = BsonDocument.Parse("{ batch : [ { a : HexData(4, \"0102030405060708090a0b0c0d0e0f10\") } ] }");
var writerSettings = new BsonBinaryWriterSettings { GuidRepresentation = GuidRepresentation.Standard };
var bson = document.ToBson(writerSettings: writerSettings);
var rawDocument = new RawBsonDocument(bson);
var batch = (RawBsonArray)rawDocument["batch"];
var documentSerializer = BsonDocumentSerializer.Instance;
var messageEncoderSettings = new MessageEncoderSettings { { "GuidRepresentation", GuidRepresentation.Standard } };
var result = CursorBatchDeserializationHelper.DeserializeBatch<BsonDocument>(batch, documentSerializer, messageEncoderSettings);
result.Count.Should().Be(1);
result[0].Should().BeOfType<BsonDocument>();
result[0].Should().Be("{ a : HexData(4, \"0102030405060708090a0b0c0d0e0f10\") }");
}
开发者ID:RavenZZ,项目名称:MDRelation,代码行数:16,代码来源:CursorBatchDeserializationHelperTests.cs
注:本文中的MongoDB.Bson.IO.BsonBinaryWriterSettings类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论