Skip to content

Commit

Permalink
Allow creation of variables dynamically via setVariable (#4800)
Browse files Browse the repository at this point in the history
* Disable MassTransitRabbitMq in Elsa.Server.Web.

* Create variable if not exists in Workflow.Core

The update introduced checks if a variable exists before attempting to set its value in the ExpressionExecutionContextExtensions. If the variable doesn't exist, it now creates one automatically.

Fixes #4789

* Remove unnecessary comment

The comment indicating to create a variable if it doesn't exist was deemed superfluous and removed from the ExpressionExecutionContextExtensions.cs file. This improves code cleanliness as the functionality is self-explanatory through the existing code structure.
  • Loading branch information
sfmskywalker committed Jan 15, 2024
1 parent 66d8e4b commit ac9428a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/bundles/Elsa.Server.Web/Program.cs
Expand Up @@ -28,7 +28,7 @@
const bool useQuartz = true;
const bool useMassTransit = true;
const bool useMassTransitAzureServiceBus = false;
const bool useMassTransitRabbitMq = true;
const bool useMassTransitRabbitMq = false;

var builder = WebApplication.CreateBuilder(args);
var services = builder.Services;
Expand Down
Expand Up @@ -292,7 +292,12 @@ where v.TryGet(context, out _)
select v;

var variable = q.FirstOrDefault();
variable?.Set(context, value);

if(variable != null)
variable.Set(context, value);

if (variable == null)
CreateVariable(context, variableName, value);
}

/// <summary>
Expand Down

0 comments on commit ac9428a

Please sign in to comment.