elsa-core
elsa-core copied to clipboard
[Feat Request] Globally configure Variable storage driver
Feature Request
Problem Overview
In cases where a (programmatic) workflow has many variables, it would be useful to globally configure the variable storage driver instead of specifying it for every variable.
Proposed Solution
Instead of doing this:
var myVariable1 = workflowBuilder.WithVariable<string>().WithMemoryStorage();
var myVariable2 = workflowBuilder.WithVariable<string>().WithMemoryStorage();
var myVariable3 = workflowBuilder.WithVariable<string>().WithMemoryStorage();
or
var myVariable1 = new Variable<string>().WithMemoryStorage();
workflowBuilder.Variables.Add(myVariable1);
var myVariable2 = new Variable<string>().WithMemoryStorage();
workflowBuilder.Variables.Add(myVariable2);
var myVariable3 = new Variable<string>().WithMemoryStorage();
workflowBuilder.Variables.Add(myVariable3);
It would be useful to do something like
workflowBuilder.WorkflowOptions.StorageDriverType = typeof(MemoryStorageDriver);
Then we don't need to specify the storage driver when creating Variables eg:
var myVariable1 = workflowBuilder.WithVariable<string>();
var myVariable2 = workflowBuilder.WithVariable<string>();
var myVariable3 = workflowBuilder.WithVariable<string>();
or
var myVariable1 = new Variable<string>();
workflowBuilder.Variables.Add(myVariable1);
var myVariable2 = new Variable<string>();
workflowBuilder.Variables.Add(myVariable2);
var myVariable3 = new Variable<string>();
workflowBuilder.Variables.Add(myVariable3);
Additional Context
https://discord.com/channels/814605913783795763/1385515616705708132/1386606615905435708