コード例 #1
0
        public CosmosDb(IDocumentClient client,
                        string databaseId,
                        int?defaultThroughput,
                        IEnumerable <ICosmosDbRepositoryBuilder> repositories,
                        bool createOnMissing,
                        ICosmosDbQueryStatsCollector statsCollector)
        {
            if (string.IsNullOrWhiteSpace(databaseId))
            {
                throw new ArgumentException("Invalid name", nameof(databaseId));
            }

            _client            = client ?? throw new ArgumentNullException(nameof(client));
            _id                = databaseId;
            _defaultThroughput = defaultThroughput;

            _database     = new AsyncLazy <Database>(() => GetOrCreateDatabaseAsync(createOnMissing));
            _repositories = repositories.Select(cb => cb.Build(_client, this, _defaultThroughput, createOnMissing, statsCollector)).ToList();
        }
コード例 #2
0
 public ICosmosDbBuilder WithQueryStats(ICosmosDbQueryStatsCollector collector)
 {
     _statsCollector = collector;
     return(this);
 }