コード例 #1
0
 public DocumentDBRepository(ICosmosClient client, IDocumentClient docClient)
 {
     _client    = client;
     _docClient = docClient;
     CreateDatabaseIfNotExistsAsync().Wait();
     CreateCollectionIfNotExistsAsync().Wait();
 }
コード例 #2
0
 public ActorRepositoryContainer(
     ICosmosClient cosmosClient,
     CosmosDatabaseConfig cosmosDatabaseConfig)
 {
     _cosmosClient         = cosmosClient;
     _cosmosDatabaseConfig = cosmosDatabaseConfig;
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 public CosmosStore(ICosmosClient cosmosClient,
                    string databaseName,
                    string overriddenCollectionName) : this(cosmosClient,
                                                            databaseName,
                                                            overriddenCollectionName,
                                                            new CosmosDatabaseCreator(cosmosClient),
                                                            new CosmosCollectionCreator(cosmosClient))
 {
 }
コード例 #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);
        }
コード例 #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);
 }
コード例 #7
0
 public CosmosDatabaseCreator(IDocumentClient documentClient)
 {
     _cosmosClient = new CosmosClient(documentClient);
 }
コード例 #8
0
 public CosmosDatabaseCreator(ICosmosClient cosmosClient)
 {
     _cosmosClient = cosmosClient;
 }
コード例 #9
0
 public CosmosCollectionCreator(IDocumentClient documentClient)
 {
     _cosmosClient = new CosmosClient(documentClient);
 }
コード例 #10
0
 public CosmosCollectionCreator(ICosmosClient cosmosClient)
 {
     _cosmosClient = cosmosClient;
 }
コード例 #11
0
 public GetUrlHandler()
 {
     this.cosmosClient = new CosmosClient();
 }
コード例 #12
0
 public DegradedHealthCheck(ICosmosClient cosmosClient)
 {
     _cosmosClient = cosmosClient;
 }
コード例 #13
0
 public DeleteUrlHandler()
 {
     this.cosmosClient = new CosmosClient();
 }
 public CosmosActivityDocumentRepository(ICosmosClient cosmosClient, ICosmosConfiguration config)
 {
     _cosmosClient = cosmosClient;
     _config       = config;
 }
コード例 #15
0
 public CosmosStore(ICosmosClient cosmosClient,
                    string databaseName) : this(cosmosClient, databaseName, string.Empty,
                                                new CosmosDatabaseCreator(cosmosClient),
                                                new CosmosCollectionCreator(cosmosClient))
 {
 }