public CosmonautClient(
     Uri endpoint,
     string authKeyOrResourceToken,
     ConnectionPolicy connectionPolicy        = null,
     ConsistencyLevel?desiredConsistencyLevel = null)
 {
     DocumentClient = DocumentClientFactory.CreateDocumentClient(endpoint, authKeyOrResourceToken, connectionPolicy, desiredConsistencyLevel);
 }
 public CosmonautClient(
     Uri endpoint,
     string authKeyOrResourceToken,
     ConnectionPolicy connectionPolicy        = null,
     ConsistencyLevel?desiredConsistencyLevel = null,
     bool infiniteRetrying = true)
 {
     DocumentClient = DocumentClientFactory.CreateDocumentClient(endpoint, authKeyOrResourceToken, connectionPolicy, desiredConsistencyLevel);
     if (infiniteRetrying)
     {
         DocumentClient.SetupInfiniteRetries();
     }
 }
Exemple #3
0
        public CosmosStore(CosmosStoreSettings settings, string overriddenCollectionName)
        {
            Settings     = settings ?? throw new ArgumentNullException(nameof(settings));
            DatabaseName = settings.DatabaseName;
            var documentClient = DocumentClientFactory.CreateDocumentClient(settings);

            CosmonautClient = new CosmonautClient(documentClient, Settings.InfiniteRetries);
            if (string.IsNullOrEmpty(Settings.DatabaseName))
            {
                throw new ArgumentNullException(nameof(Settings.DatabaseName));
            }
            _collectionCreator = new CosmosCollectionCreator(CosmonautClient);
            _databaseCreator   = new CosmosDatabaseCreator(CosmonautClient);
            InitialiseCosmosStore(overriddenCollectionName);
        }
Exemple #4
0
        public CosmosStore(CosmosStoreSettings settings,
                           IDatabaseCreator databaseCreator,
                           ICollectionCreator collectionCreator)
        {
            Settings = settings ?? throw new ArgumentNullException(nameof(settings));
            var endpointUrl = Settings.EndpointUrl ?? throw new ArgumentNullException(nameof(Settings.EndpointUrl));
            var authKey     = Settings.AuthKey ?? throw new ArgumentNullException(nameof(Settings.AuthKey));

            DocumentClient = DocumentClientFactory.CreateDocumentClient(endpointUrl, authKey);
            if (string.IsNullOrEmpty(Settings.DatabaseName))
            {
                throw new ArgumentNullException(nameof(Settings.DatabaseName));
            }
            _collectionCreator = collectionCreator ?? throw new ArgumentNullException(nameof(collectionCreator));
            _databaseCreator   = databaseCreator ?? throw new ArgumentNullException(nameof(databaseCreator));
            InitialiseCosmosStore();
        }
Exemple #5
0
        public CosmonautClient(
            Uri endpoint,
            string authKeyOrResourceToken,
            JsonSerializerSettings jsonSerializerSettings,
            ConnectionPolicy connectionPolicy        = null,
            ConsistencyLevel?desiredConsistencyLevel = null,
            bool infiniteRetrying = true)
        {
            DocumentClient = DocumentClientFactory.CreateDocumentClient(endpoint, authKeyOrResourceToken, jsonSerializerSettings, connectionPolicy, desiredConsistencyLevel);

            if (infiniteRetrying)
            {
                DocumentClient.SetupInfiniteRetries();
            }

            _serializerSettings = DocumentClient.GetJsonSerializerSettingsFromClient();
        }