Beispiel #1
0
        public CosmosContext(CosmosConfig config)
        {
            _cache = new Cache("Cosmos", config.CacheMb);
            var retriesOn429Throttling = 1;          // Number of retries before failing processing when provisioned RU/s limit in CosmosDb is breached
            var timeout   = TimeSpan.FromSeconds(5); // Timeout applied per request to CosmosDb, including retry attempts
            var discovery = Discovery.ConnectionString.NewConnectionString(config.ConnectionStringWithUriAndKey);

            _connect = async() =>
            {
                var connector = new CosmosStoreConnector(discovery, timeout, retriesOn429Throttling, timeout, config.Mode);
                _store = await Connect(connector, config.Database, config.Container);
            };
        }
Beispiel #2
0
        public CosmosContext(CosmosConfig config)
        {
            _cache = new Caching.Cache("Cosmos", config.CacheMb);
            var retriesOn429Throttling = 1;          // Number of retries before failing processing when provisioned RU/s limit in CosmosDb is breached
            var timeout   = TimeSpan.FromSeconds(5); // Timeout applied per request to CosmosDb, including retry attempts
            var discovery = Discovery.FromConnectionString(config.ConnectionStringWithUriAndKey);

            _connect = async() =>
            {
                var gateway = await Connect("App", config.Mode, discovery, timeout, retriesOn429Throttling,
                                            (int)timeout.TotalSeconds);

                var collectionMapping = new EqxCollections(config.Database, config.Collection);

                _store = new EqxStore(gateway, collectionMapping);
            };
        }