elsa-workflows / elsa-workflows/elsa-core
[Feat Request] Globally configure Variable storage driver
- Dominant language
- C#
- Stars
- 7.9k
- Forks
- 1.5k
- Avg merge
- 15h 22m
- Merged PRs (30d)
- 114
Description
## 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:
```cs
var myVariable1 = workflowBuilder.WithVariable().WithMemoryStorage();
var myVariable2 = workflowBuilder.WithVariable().WithMemoryStorage();
var myVariable3 = workflowBuilder.WithVariable().WithMemoryStorage();
```
or
```cs
var myVariable1 = new Variable().WithMemoryStorage();
workflowBuilder.Variables.Add(myVariable1);
var myVariable2 = new Variable().WithMemoryStorage();
workflowBuilder.Variables.Add(myVariable2);
var myVariable3 = new Variable().WithMemoryStorage();
workflowBuilder.Variables.Add(myVariable3);
```
It would be useful to do something like
```cs
workflowBuilder.WorkflowOptions.StorageDriverType = typeof(MemoryStorageDriver);
```
Then we don't need to specify the storage driver when creating Variables eg:
```cs
var myVariable1 = workflowBuilder.WithVariable();
var myVariable2 = workflowBuilder.WithVariable();
var myVariable3 = workflowBuilder.WithVariable();
```
or
```cs
var myVariable1 = new Variable();
workflowBuilder.Variables.Add(myVariable1);
var myVariable2 = new Variable();
workflowBuilder.Variables.Add(myVariable2);
var myVariable3 = new Variable();
workflowBuilder.Variables.Add(myVariable3);
```
### Additional Context
https://discord.com/channels/814605913783795763/1385515616705708132/1386606615905435708
Contributor guide
Assessment
This issue has not been assessed yet.