Ejemplo n.º 1
0
 public CosmosRepository(
     CosmosClient client,
     IOptions <CosmosDBRepositoryOptions <T> > options,
     ILogger <CosmosRepository <T> > logger,
     ICosmosDBRepositoryMetricsTracker <T> metricsTracker)
 {
     this._client               = client;
     this._options              = options.Value;
     this._logger               = logger;
     this._metricsTracker       = metricsTracker;
     this._collectionIdentifier = $"{options.Value.DatabaseId}.{options.Value.CollectionId}";
 }
Ejemplo n.º 2
0
        public void Configure(CosmosDBRepositoryOptions <T> options)
        {
            options.DatabaseId   = _config["COSMOSDB_DATABASEID"];
            options.CollectionId = _config["COSMOSDB_COLLECTIONID"];

            options.Container = _client
                                .GetContainer(options.DatabaseId, options.CollectionId);

            if (string.IsNullOrEmpty(_config["CosmosDBMaxParallelism"]) == false)
            {
                options.MaxParallelism = int.Parse(_config["CosmosDBMaxParallelism"], CultureInfo.InvariantCulture);
            }

            if (string.IsNullOrEmpty(_config["CosmosDBMaxBufferedItemCount"]) == false)
            {
                options.MaxBufferedItemCount = int.Parse(_config["CosmosDBMaxBufferedItemCount"], CultureInfo.InvariantCulture);
            }
        }