本文整理汇总了C#中GuidRepresentation类的典型用法代码示例。如果您正苦于以下问题:C# GuidRepresentation类的具体用法?C# GuidRepresentation怎么用?C# GuidRepresentation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GuidRepresentation类属于命名空间,在下文中一共展示了GuidRepresentation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MongoServerSettings
// constructors
/// <summary>
/// Creates a new instance of MongoServerSettings. Usually you would use a connection string instead.
/// </summary>
public MongoServerSettings()
{
_connectionMode = ConnectionMode.Automatic;
_connectTimeout = MongoDefaults.ConnectTimeout;
_credentialsStore = new MongoCredentialsStore();
_defaultCredentials = null;
_guidRepresentation = MongoDefaults.GuidRepresentation;
_ipv6 = false;
_maxConnectionIdleTime = MongoDefaults.MaxConnectionIdleTime;
_maxConnectionLifeTime = MongoDefaults.MaxConnectionLifeTime;
_maxConnectionPoolSize = MongoDefaults.MaxConnectionPoolSize;
_minConnectionPoolSize = MongoDefaults.MinConnectionPoolSize;
_readPreference = ReadPreference.Primary;
_replicaSetName = null;
_secondaryAcceptableLatency = MongoDefaults.SecondaryAcceptableLatency;
_servers = new List<MongoServerAddress> { new MongoServerAddress("localhost") };
_socketTimeout = MongoDefaults.SocketTimeout;
_useSsl = false;
_verifySslCertificate = true;
_waitQueueSize = MongoDefaults.ComputedWaitQueueSize;
_waitQueueTimeout = MongoDefaults.WaitQueueTimeout;
#pragma warning disable 612, 618
_writeConcern = MongoDefaults.SafeMode.WriteConcern;
#pragma warning restore
}
示例2: MongoUrlBuilder
// constructors
/// <summary>
/// Creates a new instance of MongoUrlBuilder.
/// </summary>
public MongoUrlBuilder()
{
_authenticationMechanism = MongoDefaults.AuthenticationMechanism;
_authenticationSource = null;
_connectionMode = ConnectionMode.Automatic;
_connectTimeout = MongoDefaults.ConnectTimeout;
_databaseName = null;
_fsync = null;
_guidRepresentation = MongoDefaults.GuidRepresentation;
_ipv6 = false;
_journal = null;
_maxConnectionIdleTime = MongoDefaults.MaxConnectionIdleTime;
_maxConnectionLifeTime = MongoDefaults.MaxConnectionLifeTime;
_maxConnectionPoolSize = MongoDefaults.MaxConnectionPoolSize;
_minConnectionPoolSize = MongoDefaults.MinConnectionPoolSize;
_password = null;
_readPreference = null;
_replicaSetName = null;
_servers = null;
_slaveOk = null;
_socketTimeout = MongoDefaults.SocketTimeout;
_username = null;
_useSsl = false;
_verifySslCertificate = true;
_w = null;
_waitQueueMultiple = MongoDefaults.WaitQueueMultiple;
_waitQueueSize = MongoDefaults.WaitQueueSize;
_waitQueueTimeout = MongoDefaults.WaitQueueTimeout;
_wTimeout = null;
}
示例3: MongoDatabaseSettings
/// <summary>
/// Creates a new instance of MongoDatabaseSettings.
/// </summary>
/// <param name="databaseName">The name of the database.</param>
/// <param name="credentials">The credentials to access the database.</param>
/// <param name="guidRepresentation">The representation for Guids.</param>
/// <param name="readPreference">The read preference.</param>
/// <param name="writeConcern">The write concern to use.</param>
public MongoDatabaseSettings(
string databaseName,
MongoCredentials credentials,
GuidRepresentation guidRepresentation,
ReadPreference readPreference,
WriteConcern writeConcern)
{
if (databaseName == null)
{
throw new ArgumentNullException("databaseName");
}
if (databaseName == "admin" && credentials != null && !credentials.Admin)
{
throw new ArgumentOutOfRangeException("credentials", "Credentials for the admin database must have the admin flag set to true.");
}
if (readPreference == null)
{
throw new ArgumentNullException("readPreference");
}
if (writeConcern == null)
{
throw new ArgumentNullException("writeConcern");
}
_databaseName = databaseName;
_credentials = credentials;
_guidRepresentation = guidRepresentation;
_readPreference = readPreference;
_writeConcern = writeConcern;
}
示例4: MongoUrlBuilder
// constructors
/// <summary>
/// Creates a new instance of MongoUrlBuilder.
/// </summary>
public MongoUrlBuilder()
{
_connectionMode = ConnectionMode.Automatic;
_connectTimeout = MongoDefaults.ConnectTimeout;
_databaseName = null;
_defaultCredentials = null;
_fsync = null;
_guidRepresentation = MongoDefaults.GuidRepresentation;
_ipv6 = false;
_journal = null;
_maxConnectionIdleTime = MongoDefaults.MaxConnectionIdleTime;
_maxConnectionLifeTime = MongoDefaults.MaxConnectionLifeTime;
_maxConnectionPoolSize = MongoDefaults.MaxConnectionPoolSize;
_minConnectionPoolSize = MongoDefaults.MinConnectionPoolSize;
_readPreference = null;
_replicaSetName = null;
_secondaryAcceptableLatency = MongoDefaults.SecondaryAcceptableLatency;
_servers = null;
_slaveOk = null;
_socketTimeout = MongoDefaults.SocketTimeout;
_useSsl = false;
_verifySslCertificate = true;
_w = null;
_waitQueueMultiple = MongoDefaults.WaitQueueMultiple;
_waitQueueSize = MongoDefaults.WaitQueueSize;
_waitQueueTimeout = MongoDefaults.WaitQueueTimeout;
_wTimeout = null;
}
示例5: JsonReaderSettings
/// <summary>
/// Initializes a new instance of the JsonReaderSettings class.
/// </summary>
/// <param name="closeInput">Whether to close the input stream when the reader is closed.</param>
/// <param name="guidRepresentation">The representation for Guids.</param>
public JsonReaderSettings(
bool closeInput,
GuidRepresentation guidRepresentation
) {
this.closeInput = closeInput;
this.guidRepresentation = guidRepresentation;
}
示例6: BsonBinaryWriterSettings
/// <summary>
/// Initializes a new instance of the BsonBinaryWriterSettings class.
/// </summary>
/// <param name="closeOutput">Whether to close the output stream when the writer is closed.</param>
/// <param name="fixOldBinarySubTypeOnOutput">Whether to fix old binary data subtype on output.</param>
/// <param name="guidRepresentation">The representation for Guids.</param>
/// <param name="maxDocumentSize">The max document size.</param>
public BsonBinaryWriterSettings(bool closeOutput, bool fixOldBinarySubTypeOnOutput, GuidRepresentation guidRepresentation, int maxDocumentSize)
: base(guidRepresentation)
{
_closeOutput = closeOutput;
_fixOldBinarySubTypeOnOutput = fixOldBinarySubTypeOnOutput;
_maxDocumentSize = maxDocumentSize;
}
示例7: MongoDatabaseSettings
/// <summary>
/// Creates a new instance of MongoDatabaseSettings.
/// </summary>
/// <param name="databaseName">The name of the database.</param>
/// <param name="credentials">The credentials to access the database.</param>
/// <param name="guidRepresentation">The representation for Guids.</param>
/// <param name="safeMode">The safe mode to use.</param>
/// <param name="slaveOk">Whether queries should be sent to secondary servers.</param>
public MongoDatabaseSettings(string databaseName, MongoCredentials credentials, GuidRepresentation guidRepresentation, SafeMode safeMode, bool slaveOk)
{
_databaseName = databaseName;
_credentials = credentials;
_guidRepresentation = guidRepresentation;
_safeMode = safeMode;
_slaveOk = slaveOk;
}
示例8: MongoDatabaseSettings
/// <summary>
/// Creates a new instance of MongoDatabaseSettings.
/// </summary>
/// <param name="databaseName">The name of the database.</param>
/// <param name="credentials">The credentials to access the database.</param>
/// <param name="guidRepresentation">The representation for Guids.</param>
/// <param name="safeMode">The safe mode to use.</param>
/// <param name="slaveOk">Whether queries should be sent to secondary servers.</param>
public MongoDatabaseSettings(string databaseName, MongoCredentials credentials, GuidRepresentation guidRepresentation, SafeMode safeMode, ReadPreference readPreference)
{
this.databaseName = databaseName;
this.credentials = credentials;
this.guidRepresentation = guidRepresentation;
this.safeMode = safeMode;
this.readPreference = readPreference;
}
示例9: BsonBinaryReaderSettings
/// <summary>
/// Initializes a new instance of the BsonBinaryReaderSettings class.
/// </summary>
/// <param name="closeInput">Whether to close the input stream when the reader is closed.</param>
/// <param name="fixOldBinarySubTypeOnInput">Whether to fix occurrences of the old binary subtype on input.</param>
/// <param name="fixOldDateTimeMaxValueOnInput">Whether to fix occurrences of the old representation of DateTime.MaxValue on input.</param>
/// <param name="guidRepresentation">The representation for Guids.</param>
/// <param name="maxDocumentSize">The max document size.</param>
public BsonBinaryReaderSettings(bool closeInput, bool fixOldBinarySubTypeOnInput, bool fixOldDateTimeMaxValueOnInput, GuidRepresentation guidRepresentation, int maxDocumentSize)
: base(guidRepresentation)
{
this.closeInput = closeInput;
this.fixOldBinarySubTypeOnInput = fixOldBinarySubTypeOnInput;
this.fixOldDateTimeMaxValueOnInput = fixOldDateTimeMaxValueOnInput;
this.maxDocumentSize = maxDocumentSize;
}
示例10: ReadJson_should_return_expected_result_when_using_native_bson_reader
public void ReadJson_should_return_expected_result_when_using_native_bson_reader(string json, GuidRepresentation guidRepresentation, string nullableHexBytes, BsonBinarySubType subType)
{
var subject = new BsonBinaryDataConverter();
var expectedResult = nullableHexBytes == null ? null : new BsonBinaryData(BsonUtils.ParseHexString(nullableHexBytes), subType);
var result = ReadJsonUsingNativeBsonReader<BsonBinaryData>(subject, ToBson(json, guidRepresentation), mustBeNested: true);
result.Should().Be(expectedResult);
}
开发者ID:rstam,项目名称:mongo-csharp-driver-jsondotnet-original,代码行数:9,代码来源:BsonBinaryDataConverterTests.cs
示例11: MongoDatabaseSettings
// constructors
/// <summary>
/// Creates a new instance of MongoDatabaseSettings.
/// </summary>
/// <param name="server">The server to inherit settings from.</param>
/// <param name="databaseName">The name of the database.</param>
public MongoDatabaseSettings(MongoServer server, string databaseName)
{
var serverSettings = server.Settings;
_databaseName = databaseName;
_credentials = serverSettings.DefaultCredentials;
_guidRepresentation = serverSettings.GuidRepresentation;
_safeMode = serverSettings.SafeMode;
_slaveOk = serverSettings.SlaveOk;
}
示例12: MongoCollectionSettings
// constructors
/// <summary>
/// Initializes a new instance of the MongoCollectionSettings class.
/// </summary>
/// <param name="database">The database that contains the collection (some collection settings will be inherited from the database settings).</param>
/// <param name="collectionName">The name of the collection.</param>
/// <param name="defaultDocumentType">The default document type for the collection.</param>
protected MongoCollectionSettings(MongoDatabase database, string collectionName, Type defaultDocumentType)
{
var databaseSettings = database.Settings;
_collectionName = collectionName;
_assignIdOnInsert = MongoDefaults.AssignIdOnInsert;
_defaultDocumentType = defaultDocumentType;
_guidRepresentation = databaseSettings.GuidRepresentation;
_safeMode = databaseSettings.SafeMode;
_slaveOk = databaseSettings.SlaveOk;
}
示例13: BsonBinaryReaderSettings
/// <summary>
/// Initializes a new instance of the BsonBinaryReaderSettings class.
/// </summary>
/// <param name="closeInput">Whether to close the input stream when the reader is closed.</param>
/// <param name="fixOldBinarySubTypeOnInput">Whether to fix occurrences of the old binary subtype on input.</param>
/// <param name="guidRepresentation">The representation for Guids.</param>
/// <param name="maxDocumentSize">The max document size.</param>
public BsonBinaryReaderSettings(
bool closeInput,
bool fixOldBinarySubTypeOnInput,
GuidRepresentation guidRepresentation,
int maxDocumentSize
) {
this.closeInput = closeInput;
this.fixOldBinarySubTypeOnInput = fixOldBinarySubTypeOnInput;
this.guidRepresentation = guidRepresentation;
this.maxDocumentSize = maxDocumentSize;
}
示例14: JsonWriterSettings
/// <summary>
/// Initializes a new instance of the JsonWriterSettings class.
/// </summary>
/// <param name="closeOutput">Whether to close the output when the writer is closed.</param>
/// <param name="encoding">The output Encoding.</param>
/// <param name="guidRepresentation">The representation for Guids.</param>
/// <param name="indent">Whether to indent the output.</param>
/// <param name="indentChars">The indentation characters.</param>
/// <param name="newLineChars">The new line characters.</param>
/// <param name="outputMode">The output mode.</param>
/// <param name="shellVersion">The version of the shell to target.</param>
public JsonWriterSettings(bool closeOutput, Encoding encoding, GuidRepresentation guidRepresentation, bool indent, string indentChars, string newLineChars, JsonOutputMode outputMode, Version shellVersion)
: base(guidRepresentation)
{
_closeOutput = closeOutput;
_encoding = encoding;
_indent = indent;
_indentChars = indentChars;
_newLineChars = newLineChars;
_outputMode = outputMode;
_shellVersion = shellVersion;
}
示例15: ReadBinaryData
/// <summary>
/// Reads BSON binary data from the reader.
/// </summary>
/// <param name="bytes">The binary data.</param>
/// <param name="subType">The binary data subtype.</param>
/// <param name="guidRepresentation">The representation for Guids.</param>
public override void ReadBinaryData(
out byte[] bytes,
out BsonBinarySubType subType,
out GuidRepresentation guidRepresentation
) {
if (disposed) { ThrowObjectDisposedException(); }
VerifyBsonType("ReadBinaryData", BsonType.Binary);
state = GetNextState();
var binaryData = currentValue.AsBsonBinaryData;
bytes = binaryData.Bytes;
subType = binaryData.SubType;
guidRepresentation = binaryData.GuidRepresentation;
}