internal MongoDriveInfo(MongoProviderParameters driveParameters, PSDriveInfo drive) : base(drive) { DriveParameters = driveParameters; if (string.IsNullOrEmpty(DriveParameters.Collection)) { DriveParameters.Collection = GridFsDefaultBucketName; } }
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()); }