Classe WorkflowVariableActions

Namespace: Microsoft.Azure. Workflows.Sdk

Fornisce metodi di fabbrica per creare azioni di manipolazione variabile nei flussi di lavoro di Logic Apps. Accedi a questa classe tramite WorkflowBuiltInActions usando WorkflowActions.BuiltIn.Variables.

Usage

// Variable actions are accessed via WorkflowActions.BuiltIn.Variables
var trigger = WorkflowTriggers.BuiltIn.CreateHttpTrigger();

var init = WorkflowActions.BuiltIn.Variables.InitializeVariable<int>(
    name: () => "counter", value: () => 0).WithName("InitCounter");
var increment = WorkflowActions.BuiltIn.Variables.IncrementVariable<int>(
    name: () => "counter", value: () => 1).WithName("AddOne");

trigger.Then(init).Then(increment);
WorkflowFactory.CreateStatefulWorkflow("VariableExample", trigger);

Methods

InitializeVariable<T>(nome stringa< Function<Espressione>>, valore Func<T< Espressione>>)

Crea un'IVariableWorkflowAction che dichiara una variabile del flusso di lavoro con il suo valore iniziale.

IVariableWorkflowAction InitializeVariable<T>(Expression<Func<string>> name, Expression<Func<T>> value)
Name Description TIPO Required
name Espressione per il nome della variabile. Stringa func<di espressione<>>
value Espressione per il valore iniziale. Funzione di espressione<<T>>
var initVar = WorkflowActions.BuiltIn.Variables.InitializeVariable<string>(
    name: () => "greeting",
    value: () => "Hello").WithName("InitGreeting");

SetVariable<T>(nome stringa< Funzione<Espressione>>, valore Funzione<Espressione<T>>)

Crea un'IVariableWorkflowAction che assegna un nuovo valore a una variabile di workflow esistente.

IVariableWorkflowAction SetVariable<T>(Expression<Func<string>> name, Expression<Func<T>> value)
Name Description TIPO Required
name Espressione per il nome della variabile. Stringa func<di espressione<>>
value Espressione per il nuovo valore. Funzione di espressione<<T>>
var setVar = WorkflowActions.BuiltIn.Variables.SetVariable<string>(
    name: () => "greeting",
    value: () => "Updated greeting").WithName("UpdateGreeting");

IncrementVariable<T>(nome stringa Funzione<< Espressione>>, valore Funzione<Espressione<T>>)

Crea un IVariableWorkflowAction che incrementa una variabile numerica.

IVariableWorkflowAction IncrementVariable<T>(Expression<Func<string>> name, Expression<Func<T>> value)
Name Description TIPO Required
name Espressione per il nome della variabile. Stringa func<di espressione<>>
value Espressione per il valore incrementale. Funzione di espressione<<T>>
var increment = WorkflowActions.BuiltIn.Variables.IncrementVariable<int>(
    name: () => "counter",
    value: () => 1).WithName("IncrementCounter");

DecrementVariable<T>(nome della stringa<< di funzione di espressione>>, valore della funzione<di espressione<T>>)

Crea un'IVariableWorkflowAction che decrementa una variabile numerica.

IVariableWorkflowAction DecrementVariable<T>(Expression<Func<string>> name, Expression<Func<T>> value)
Name Description TIPO Required
name Espressione per il nome della variabile. Stringa func<di espressione<>>
value Espressione per il valore decremento. Funzione di espressione<<T>>
var decrement = WorkflowActions.BuiltIn.Variables.DecrementVariable<int>(
    name: () => "counter",
    value: () => 1).WithName("DecrementCounter");

AppendToStringVariableT

Crea una IVariableWorkflowAction che aggiunge testo a una variabile stringa.

IVariableWorkflowAction AppendToStringVariable(Expression<Func<string>> name, Expression<Func<string>> value)
Name Description TIPO Required
name Espressione per il nome della variabile. Stringa func<di espressione<>>
value Espressione per la stringa da aggiungere. Stringa func<di espressione<>>
var append = WorkflowActions.BuiltIn.Variables.AppendToStringVariable(
    name: () => "log",
    value: () => " new entry").WithName("AppendLog");

AppendToArrayVariable<T> (nome stringa< Expression<Func>>, valore Expression<Func<T>>)

Crea un IVariableWorkflowAction che aggiunge un valore a una variabile dell'array.

IVariableWorkflowAction AppendToArrayVariable<T>(Expression<Func<string>> name, Expression<Func<T>> value)
Name Description TIPO Required
name Espressione per il nome della variabile. Stringa func<di espressione<>>
value Espressione per il valore da aggiungere. Funzione di espressione<<T>>
var appendArray = WorkflowActions.BuiltIn.Variables.AppendToArrayVariable<string>(
    name: () => "items",
    value: () => "new item").WithName("AddItem");