//-------------- An entity that launches an orchestration -----------------

        public static void LauncherEntity([EntityTrigger(EntityName = "Launcher")] IDurableEntityContext context)
        {
            var(id, done) = context.HasState ? context.GetState <(string, bool)>() : (null, false);

            switch (context.OperationName)
            {
            case "launch":
            {
                id = context.StartNewOrchestration(nameof(TestOrchestrations.DelayedSignal), context.EntityId);
                break;
            }

            case "done":
            {
                done = true;
                break;
            }

            case "get":
            {
                context.Return(done ? id : null);
                break;
            }

            default:
                throw new NotImplementedException("no such entity operation");
            }

            context.SetState((id, done));
        }
Пример #2
0
        public static void Run([EntityTrigger] IDurableEntityContext ctx, ILogger log)
        {
            var action = ctx.OperationName.ToLowerInvariant();

            var state = ctx.GetState <ReportingManagementState>();

            if (action == "$init" && state == null)
            {
                state = new ReportingManagementState(ctx.GetInput <StateDetails>());
            }

            switch (action)
            {
            case "savepowerbiconnection":
                var actionReq = ctx.GetInput <ExecuteActionRequest>();

                state.SavePowerBIConnection(actionReq.Arguments.Metadata["PowerBI"].ToObject <PowerBIModel>());
                break;
            }

            ctx.SetState(state);

            ctx.StartNewOrchestration("SendState", state);

            // ctx.Return(state);
        }