示例#1
0
 internal MongoDriveInfo(MongoProviderParameters driveParameters, PSDriveInfo drive) : base(drive)
 {
     DriveParameters = driveParameters;
     if (string.IsNullOrEmpty(DriveParameters.Collection))
     {
         DriveParameters.Collection = GridFsDefaultBucketName;
     }
 }
示例#2
0
        private string BuildMongoConnectionString(MongoProviderParameters driveParameters)
        {
            var credentialString = "";

            if (Credential != null && Credential.UserName != null && Credential.Password != null)
            {
                credentialString = $"{Credential.UserName}:{Credential.GetNetworkCredential().Password}@";
            }

            var host = driveParameters.Host;
            var port = driveParameters.Port;

            var connectionString = $"mongodb://{credentialString}{host}:{port}";

            return(new ConnectionString(connectionString).ToString());
        }