Exemplo n.º 1
0
        public async Task <TeamCloudInstanceDocument> RunActivity(
            [ActivityTrigger] TeamCloudInstanceDocument teamCloudInstance)
        {
            if (teamCloudInstance is null)
            {
                throw new ArgumentNullException(nameof(teamCloudInstance));
            }

            teamCloudInstance = await teamCloudRepository
                                .SetAsync(teamCloudInstance)
                                .ConfigureAwait(false);

            return(teamCloudInstance);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Post(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = "data/teamCloudInstance")] TeamCloudInstanceDocument teamCloudInstance)
        {
            if (teamCloudInstance is null)
            {
                throw new ArgumentNullException(nameof(teamCloudInstance));
            }

            var newTeamCloudInstance = await teamCloudRepository
                                       .SetAsync(teamCloudInstance)
                                       .ConfigureAwait(false);

            return(new OkObjectResult(newTeamCloudInstance));
        }
Exemplo n.º 3
0
        public static Task <TeamCloudInstanceDocument> SetTeamCloudAsync(this IDurableOrchestrationContext functionContext, TeamCloudInstanceDocument teamCloud)
        {
            if (teamCloud is null)
            {
                throw new ArgumentNullException(nameof(teamCloud));
            }

            if (functionContext.IsLockedByContainerDocument(teamCloud))
            {
                return(functionContext
                       .CallActivityWithRetryAsync <TeamCloudInstanceDocument>(nameof(TeamCloudSetActivity), teamCloud));
            }

            throw new NotSupportedException($"Unable to set '{typeof(TeamCloudInstanceDocument)}' without acquired lock");
        }