public override void Dispose() { if (_sourceClient != null) { _sourceClient.Dispose(); _sourceClient = null; } if (_targetClient != null) { _targetClient.Dispose(); _targetClient = null; } base.Dispose(); }
public DocDbSyncWorker( IKeyVaultClient kvClient, IOptions <VaultSettings> vaultSettings, IOptionsSnapshot <DocDbSettings> source, IOptionsSnapshot <DocDbSettings> target, IOptions <DataSyncSettings> syncSettings, ILoggerFactory loggerFactory, TelemetryClient telemetry) { _source = source.Get("source"); _sourceClient = new DocumentDbClient(kvClient, vaultSettings, _source, loggerFactory.CreateLogger <DocumentDbClient>(), telemetry); _target = target.Get("target"); _targetClient = new DocumentDbClient(kvClient, vaultSettings, _target, loggerFactory.CreateLogger <DocumentDbClient>(), telemetry); _syncSettings = syncSettings.Value; _logger = loggerFactory.CreateLogger <DocDbSyncWorker>(); _telemetry = telemetry; }
public CopyCollectionsWorker( IKeyVaultClient kvClient, IOptions <VaultSettings> vaultSettings, IOptions <CopyCollectionsSettings> settings, ILoggerFactory loggerFactory, TelemetryClient telemetry) { _settings = settings.Value; _logger = loggerFactory.CreateLogger <CopyCollectionsWorker>(); _telemetry = telemetry; _sourceClient = new DocumentDbClient(kvClient, vaultSettings, _settings.Source, loggerFactory.CreateLogger <DocumentDbClient>(), telemetry); _targetClient = new DocumentDbClient(kvClient, vaultSettings, _settings.Target, loggerFactory.CreateLogger <DocumentDbClient>(), telemetry); _ru = _telemetry.GetMetric("bulk_executor_ru", "collection_name"); _docCount = _telemetry.GetMetric("bulk_executor_docs", "collection_name"); _latency = _telemetry.GetMetric("bulk_executor_latency", "collection_name"); _error = _telemetry.GetMetric("bulk_executor_errors", "collection_name"); }
public DocDbBulkSyncWorker( IKeyVaultClient kvClient, IOptions <VaultSettings> vaultSettings, IOptionsSnapshot <DocDbSettings> source, IOptionsSnapshot <DocDbSettings> target, IOptions <DataSyncSettings> syncSettings, ILoggerFactory loggerFactory, TelemetryClient telemetry) { _source = source.Get("source"); _sourceClient = new DocumentDbClient(kvClient, vaultSettings, _source, loggerFactory.CreateLogger <DocumentDbClient>(), telemetry); _target = target.Get("target"); _targetClient = new DocumentDbClient(kvClient, vaultSettings, _target, loggerFactory.CreateLogger <DocumentDbClient>(), telemetry); _syncSettings = syncSettings.Value; _logger = loggerFactory.CreateLogger <DocDbBulkSyncWorker>(); _telemetry = telemetry; _ru = _telemetry.GetMetric("bulk_executor_ru", "operation_name"); _docCount = _telemetry.GetMetric("bulk_executor_docs", "operation_name"); _latency = _telemetry.GetMetric("bulk_executor_latency", "operation_name"); _error = _telemetry.GetMetric("bulk_executor_errors", "operation_name"); }
public CreateSimulateGoalHandler(IDocumentDbClient client) { _client = client; }
public CartRepository(IDocumentDbClient <CartItem> dbClient) { _dbClient = dbClient ?? throw new ArgumentNullException(nameof(dbClient)); }
public void CartRepository_WithNullArgument_ShouldThrowNullException(IDocumentDbClient <CartItem> dbClient, string paramName) { var except = Assert.Throws <ArgumentNullException>(() => new CartRepository(dbClient)); Assert.Equal(paramName, except.ParamName); }