Exemple #1
0
 public DocumentDBRepository(ICosmosClient client, IDocumentClient docClient)
 {
     _client    = client;
     _docClient = docClient;
     CreateDatabaseIfNotExistsAsync().Wait();
     CreateCollectionIfNotExistsAsync().Wait();
 }
Exemple #2
0
 public ActorRepositoryContainer(
     ICosmosClient cosmosClient,
     CosmosDatabaseConfig cosmosDatabaseConfig)
 {
     _cosmosClient         = cosmosClient;
     _cosmosDatabaseConfig = cosmosDatabaseConfig;
 }
 public static IServiceCollection AddCosmosStore <TEntity>(this IServiceCollection services,
                                                           ICosmosClient cosmosClient,
                                                           string databaseName,
                                                           string overriddenCollectionName = "") where TEntity : class
 {
     services.AddSingleton <ICosmosStore <TEntity> >(x => new CosmosStore <TEntity>(cosmosClient, databaseName, overriddenCollectionName));
     return(services);
 }
Exemple #4
0
 public CosmosStore(ICosmosClient cosmosClient,
                    string databaseName,
                    string overriddenCollectionName) : this(cosmosClient,
                                                            databaseName,
                                                            overriddenCollectionName,
                                                            new CosmosDatabaseCreator(cosmosClient),
                                                            new CosmosCollectionCreator(cosmosClient))
 {
 }
Exemple #5
0
        public CosmosStore(CosmosStoreSettings settings, string overriddenCollectionName)
        {
            Settings     = settings ?? throw new ArgumentNullException(nameof(settings));
            DatabaseName = settings.DatabaseName;
            var documentClient = DocumentClientFactory.CreateDocumentClient(settings);

            CosmosClient = new CosmosClient(documentClient, Settings.InfiniteRetries);
            if (string.IsNullOrEmpty(Settings.DatabaseName))
            {
                throw new ArgumentNullException(nameof(Settings.DatabaseName));
            }
            _collectionCreator = new CosmosCollectionCreator(CosmosClient);
            _databaseCreator   = new CosmosDatabaseCreator(CosmosClient);
            InitialiseCosmosStore(overriddenCollectionName);
        }
Exemple #6
0
 private CosmosStore(ICosmosClient cosmosClient,
                     string databaseName,
                     string overriddenCollectionName,
                     IDatabaseCreator databaseCreator     = null,
                     ICollectionCreator collectionCreator = null)
 {
     DatabaseName = databaseName;
     CosmosClient = cosmosClient ?? throw new ArgumentNullException(nameof(cosmosClient));
     Settings     = new CosmosStoreSettings(databaseName, cosmosClient.DocumentClient.ServiceEndpoint.ToString(), string.Empty, cosmosClient.DocumentClient.ConnectionPolicy);
     if (Settings.InfiniteRetries)
     {
         CosmosClient.DocumentClient.SetupInfiniteRetries();
     }
     if (string.IsNullOrEmpty(Settings.DatabaseName))
     {
         throw new ArgumentNullException(nameof(Settings.DatabaseName));
     }
     _collectionCreator = collectionCreator ?? new CosmosCollectionCreator(CosmosClient);
     _databaseCreator   = databaseCreator ?? new CosmosDatabaseCreator(CosmosClient);
     InitialiseCosmosStore(overriddenCollectionName);
 }
 public CosmosDatabaseCreator(IDocumentClient documentClient)
 {
     _cosmosClient = new CosmosClient(documentClient);
 }
 public CosmosDatabaseCreator(ICosmosClient cosmosClient)
 {
     _cosmosClient = cosmosClient;
 }
 public CosmosCollectionCreator(IDocumentClient documentClient)
 {
     _cosmosClient = new CosmosClient(documentClient);
 }
 public CosmosCollectionCreator(ICosmosClient cosmosClient)
 {
     _cosmosClient = cosmosClient;
 }
Exemple #11
0
 public GetUrlHandler()
 {
     this.cosmosClient = new CosmosClient();
 }
 public DegradedHealthCheck(ICosmosClient cosmosClient)
 {
     _cosmosClient = cosmosClient;
 }
Exemple #13
0
 public DeleteUrlHandler()
 {
     this.cosmosClient = new CosmosClient();
 }
 public CosmosActivityDocumentRepository(ICosmosClient cosmosClient, ICosmosConfiguration config)
 {
     _cosmosClient = cosmosClient;
     _config       = config;
 }
Exemple #15
0
 public CosmosStore(ICosmosClient cosmosClient,
                    string databaseName) : this(cosmosClient, databaseName, string.Empty,
                                                new CosmosDatabaseCreator(cosmosClient),
                                                new CosmosCollectionCreator(cosmosClient))
 {
 }