コード例 #1
0
 public CosmosDbPersistenceProvider(ICosmosClientFactory clientFactory, string dbId, ICosmosDbProvisioner provisioner)
 {
     _provisioner           = provisioner;
     _dbId                  = dbId;
     _clientFactory         = clientFactory;
     _workflowContainer     = new Lazy <Container>(() => _clientFactory.GetCosmosClient().GetDatabase(_dbId).GetContainer(WorkflowContainerName));
     _eventContainer        = new Lazy <Container>(() => _clientFactory.GetCosmosClient().GetDatabase(_dbId).GetContainer(EventContainerName));
     _subscriptionContainer = new Lazy <Container>(() => _clientFactory.GetCosmosClient().GetDatabase(_dbId).GetContainer(SubscriptionContainerName));
 }
コード例 #2
0
        public async Task Provision(string dbId)
        {
            var dbResp = await _clientFactory.GetCosmosClient().CreateDatabaseIfNotExistsAsync(dbId);

            var wfIndexPolicy = new IndexingPolicy();

            wfIndexPolicy.IncludedPaths.Add(new IncludedPath {
                Path = @"/*"
            });
            wfIndexPolicy.ExcludedPaths.Add(new ExcludedPath {
                Path = @"/ExecutionPointers/?"
            });

            Task.WaitAll(
                dbResp.Database.CreateContainerIfNotExistsAsync(new ContainerProperties(CosmosDbPersistenceProvider.WorkflowContainerName, @"/id")
            {
                IndexingPolicy = wfIndexPolicy
            }),
                dbResp.Database.CreateContainerIfNotExistsAsync(new ContainerProperties(CosmosDbPersistenceProvider.EventContainerName, @"/id")),
                dbResp.Database.CreateContainerIfNotExistsAsync(new ContainerProperties(CosmosDbPersistenceProvider.SubscriptionContainerName, @"/id"))
                );
        }
コード例 #3
0
        public async Task Provision(string dbId, CancellationToken cancellationToken = default)
        {
            var dbResp = await _clientFactory.GetCosmosClient().CreateDatabaseIfNotExistsAsync(dbId, cancellationToken: cancellationToken);

            var wfIndexPolicy = new IndexingPolicy();

            wfIndexPolicy.IncludedPaths.Add(new IncludedPath {
                Path = @"/*"
            });
            wfIndexPolicy.ExcludedPaths.Add(new ExcludedPath {
                Path = @"/ExecutionPointers/?"
            });

            Task.WaitAll(
                dbResp.Database.CreateContainerIfNotExistsAsync(new ContainerProperties(_cosmosDbStorageOptions.WorkflowContainerName, @"/id")
            {
                IndexingPolicy = wfIndexPolicy
            }),
                dbResp.Database.CreateContainerIfNotExistsAsync(new ContainerProperties(_cosmosDbStorageOptions.EventContainerName, @"/id")),
                dbResp.Database.CreateContainerIfNotExistsAsync(new ContainerProperties(_cosmosDbStorageOptions.SubscriptionContainerName, @"/id"))
                );
        }
コード例 #4
0
 public WorkflowPurger(ICosmosClientFactory clientFactory, string dbId, CosmosDbStorageOptions cosmosDbStorageOptions)
 {
     _workflowContainer = new Lazy <Container>(() => clientFactory.GetCosmosClient()
                                               .GetDatabase(dbId)
                                               .GetContainer(cosmosDbStorageOptions.WorkflowContainerName));
 }