// constructors
 public AutoEncryptionLibMongoCryptController(
     IMongoClient client,
     CryptClient cryptClient,
     AutoEncryptionOptions autoEncryptionOptions)
     : base(
         Ensure.IsNotNull(cryptClient, nameof(cryptClient)),
         Ensure.IsNotNull(autoEncryptionOptions, nameof(autoEncryptionOptions)).KeyVaultClient ?? client,
         Ensure.IsNotNull(Ensure.IsNotNull(autoEncryptionOptions, nameof(autoEncryptionOptions)).KeyVaultNamespace, nameof(autoEncryptionOptions.KeyVaultNamespace)))
 {
     _client             = Ensure.IsNotNull(client, nameof(client)); // _client might not be fully constructed at this point, don't call any instance methods on it yet
     _mongocryptdFactory = new MongocryptdFactory(autoEncryptionOptions.ExtraOptions);
     _mongocryptdClient  = _mongocryptdFactory.CreateMongocryptdClient();
 }
示例#2
0
 // constructors
 private AutoEncryptionLibMongoCryptController(
     IMongoClient internalClient,
     IMongoClient keyVaultClient,
     IMongoClient metadataClient,
     CryptClient cryptClient,
     AutoEncryptionOptions autoEncryptionOptions)
     : base(
         Ensure.IsNotNull(cryptClient, nameof(cryptClient)),
         Ensure.IsNotNull(keyVaultClient, nameof(keyVaultClient)),
         Ensure.IsNotNull(Ensure.IsNotNull(autoEncryptionOptions, nameof(autoEncryptionOptions)).KeyVaultNamespace, nameof(autoEncryptionOptions.KeyVaultNamespace)))
 {
     _internalClient     = internalClient; // can be null
     _metadataClient     = metadataClient; // can be null
     _mongocryptdFactory = new MongocryptdFactory(autoEncryptionOptions.ExtraOptions);
     _mongocryptdClient  = _mongocryptdFactory.CreateMongocryptdClient();
 }